mirror of
https://github.com/n3w/helpers-functions-cli.git
synced 2025-12-19 12:43:22 +00:00
Updated to work with pointybeard/helpers-cli-input 1.1.x
This commit is contained in:
parent
94801ba0e6
commit
f40e14845e
1 changed files with 9 additions and 4 deletions
|
|
@ -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,13 +102,18 @@ 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) {
|
||||
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.
|
||||
if(false === empty($arguments)){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue