mirror of
https://github.com/crazywhalecc/quick-shell.git
synced 2026-07-05 07:45:42 +08:00
update to 1.0.0
This commit is contained in:
43
src/QuickShell/Annotations/Command.php
Normal file
43
src/QuickShell/Annotations/Command.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php /** @noinspection PhpLanguageLevelInspection */
|
||||
|
||||
namespace QuickShell\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\Common\Annotations\Annotation\Required;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
use ZM\Annotation\AnnotationBase;
|
||||
use ZM\Annotation\Interfaces\CustomAnnotation;
|
||||
use ZM\Annotation\Interfaces\Level;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("ALL")
|
||||
* @NamedArgumentConstructor()
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_ALL | Attribute::IS_REPEATABLE)]
|
||||
class Command extends AnnotationBase implements CustomAnnotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @Required()
|
||||
*/
|
||||
public string $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public string $description = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public string $alias = '';
|
||||
|
||||
public function __construct(string $name, string $description = '', string $alias = '')
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->description = $description;
|
||||
$this->alias = $alias;
|
||||
}
|
||||
}
|
||||
46
src/QuickShell/Annotations/CommandArgument.php
Normal file
46
src/QuickShell/Annotations/CommandArgument.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace QuickShell\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use ZM\Annotation\AnnotationBase;
|
||||
use ZM\Annotation\Interfaces\CustomAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("METHOD")
|
||||
* @NamedArgumentConstructor()
|
||||
*/
|
||||
#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_METHOD)]
|
||||
class CommandArgument extends AnnotationBase implements CustomAnnotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @Required()
|
||||
*/
|
||||
public string $argument_name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public string $description = '';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public bool $one_argument = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public bool $allow_empty = false;
|
||||
|
||||
public function __construct(string $argument_name, string $description = '', bool $one_argument = false, bool $allow_empty = false)
|
||||
{
|
||||
$this->argument_name = $argument_name;
|
||||
$this->description = $description;
|
||||
$this->one_argument = $one_argument;
|
||||
$this->allow_empty = $allow_empty;
|
||||
}
|
||||
}
|
||||
34
src/QuickShell/Annotations/CommandCategory.php
Normal file
34
src/QuickShell/Annotations/CommandCategory.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace QuickShell\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\Common\Annotations\Annotation\Required;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
use ZM\Annotation\AnnotationBase;
|
||||
use ZM\Annotation\Interfaces\CustomAnnotation;
|
||||
use ZM\Annotation\Interfaces\ErgodicAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("CLASS")
|
||||
* @NamedArgumentConstructor()
|
||||
*/
|
||||
#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_CLASS)]
|
||||
class CommandCategory extends AnnotationBase implements CustomAnnotation, ErgodicAnnotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @Required()
|
||||
*/
|
||||
public string $category;
|
||||
|
||||
public string $description = '';
|
||||
|
||||
public function __construct(string $category, string $description = '')
|
||||
{
|
||||
$this->category = $category;
|
||||
$this->description = $description;
|
||||
}
|
||||
}
|
||||
41
src/QuickShell/Annotations/CommandOption.php
Normal file
41
src/QuickShell/Annotations/CommandOption.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php /** @noinspection PhpLanguageLevelInspection */
|
||||
|
||||
namespace QuickShell\Annotations;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
use ZM\Annotation\AnnotationBase;
|
||||
use ZM\Annotation\Interfaces\CustomAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("METHOD")
|
||||
* @NamedArgumentConstructor()
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
|
||||
class CommandOption extends AnnotationBase implements CustomAnnotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @Required()
|
||||
*/
|
||||
public string $option_name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public string $description = '';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public bool $required = false;
|
||||
|
||||
public function __construct(string $option_name, string $description = '', bool $required = false)
|
||||
{
|
||||
$this->option_name = $option_name;
|
||||
$this->description = $description;
|
||||
$this->required = $required;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user