diff --git a/src/Cli/Cli.php b/src/Cli/Cli.php index 14e9454..00d1703 100644 --- a/src/Cli/Cli.php +++ b/src/Cli/Cli.php @@ -42,7 +42,7 @@ if (!function_exists(__NAMESPACE__.'usage')) { function usage(string $name, Input\InputCollection $collection): string { $arguments = []; - foreach ($collection->getArguments() as $a) { + foreach ($collection->getItemsByType('Argument') as $a) { $arguments[] = strtoupper( // Wrap with square brackets if it's not required Flags\is_flag_set(Input\AbstractInputType::FLAG_OPTIONAL, $a->flags()) || @@ -102,12 +102,17 @@ if (!function_exists(__NAMESPACE__.'manpage')) { $arguments = []; $options = []; - foreach ($collection->getArguments() as $a) { + foreach ($collection->getItemsByType("Argument") as $a) { $arguments[] = (string) $a; } - foreach ($collection->getOptions() as $o) { - $options[] = (string) $o; + foreach($collection->getTypes() as $type) { + if($type == 'Argument') { + continue; + } + foreach ($collection->getItemsByType($type) as $o) { + $options[] = (string) $o; + } } // Add the arguments, if there are any.