Files
farmOS-dev/vendor/consolidation/annotated-command/src/Attributes/Usage.php
2024-12-10 15:08:16 +01:00

29 lines
686 B
PHP

<?php
namespace Consolidation\AnnotatedCommand\Attributes;
use Attribute;
use Consolidation\AnnotatedCommand\Parser\CommandInfo;
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
class Usage
{
/**
* @param $name
* The example command.
* @param $description
* A one line description.
*/
public function __construct(
public string $name,
public ?string $description = null
) {
}
public static function handle(\ReflectionAttribute $attribute, CommandInfo $commandInfo)
{
$args = $attribute->getArguments();
$commandInfo->setExampleUsage($args['name'], @$args['description']);
}
}