parent
26815fcac3
commit
c40a14aba0
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace jrosset\CliProgram;
|
||||||
|
|
||||||
|
use Attribute;
|
||||||
|
use jrosset\CliProgram\AutoDiscovery\IAutoDiscoverySpot;
|
||||||
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attribute to tag command
|
||||||
|
*
|
||||||
|
* Identical to {@see AsCommand} but allow empty command name (i.e., for {@see IAutoDiscoverySpot})
|
||||||
|
*/
|
||||||
|
#[Attribute(Attribute::TARGET_CLASS)]
|
||||||
|
class CliCommand {
|
||||||
|
/**
|
||||||
|
* @var string|null The commande name
|
||||||
|
*/
|
||||||
|
public readonly ?string $name;
|
||||||
|
/**
|
||||||
|
* @var string|null The command description
|
||||||
|
*/
|
||||||
|
public readonly ?string $description;
|
||||||
|
/**
|
||||||
|
* @var string[] The command aliases
|
||||||
|
*/
|
||||||
|
public readonly array $aliases;
|
||||||
|
/**
|
||||||
|
* @var bool Is the command hidden from command list ?
|
||||||
|
*/
|
||||||
|
public readonly bool $hidden;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization
|
||||||
|
*
|
||||||
|
* @param string|null $name The commande name
|
||||||
|
* @param string|null $description The command description
|
||||||
|
* @param string[] $aliases The command aliases
|
||||||
|
* @param bool $hidden Is the command hidden from command list ?
|
||||||
|
*/
|
||||||
|
public function __construct (?string $name, ?string $description, array $aliases, bool $hidden) {
|
||||||
|
$this->name = $name;
|
||||||
|
$this->description = $description;
|
||||||
|
$this->aliases = $aliases;
|
||||||
|
$this->hidden = $hidden;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue