UserListCommand.php 908 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace Test\Michel\Console\Command;
  3. use Michel\Console\Command\CommandInterface;
  4. use Michel\Console\InputInterface;
  5. use Michel\Console\Option\CommandOption;
  6. use Michel\Console\OutputInterface;
  7. class UserListCommand implements CommandInterface
  8. {
  9. public function getName(): string
  10. {
  11. return 'app:user:list';
  12. }
  13. public function getDescription(): string
  14. {
  15. return 'TEST : User list';
  16. }
  17. public function getOptions(): array
  18. {
  19. return [
  20. CommandOption::withValue('limit', 'l', 'Limit the number of results', 100),
  21. ];
  22. }
  23. public function getArguments(): array
  24. {
  25. return [
  26. ];
  27. }
  28. public function execute(InputInterface $input, OutputInterface $output): void
  29. {
  30. $output->write('Test OK : User list');
  31. $output->write(sprintf('LIMIT : %d', $input->getOptionValue('limit')));
  32. }
  33. }