From f40e14845e663b75b386074237eac28ccf7c967f Mon Sep 17 00:00:00 2001 From: Alannah Kearney Date: Fri, 24 May 2019 17:33:00 +1000 Subject: [PATCH] Updated to work with pointybeard/helpers-cli-input 1.1.x --- src/Cli/Cli.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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.