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
|
function usage(string $name, Input\InputCollection $collection): string
|
||||||
{
|
{
|
||||||
$arguments = [];
|
$arguments = [];
|
||||||
foreach ($collection->getArguments() as $a) {
|
foreach ($collection->getItemsByType('Argument') as $a) {
|
||||||
$arguments[] = strtoupper(
|
$arguments[] = strtoupper(
|
||||||
// Wrap with square brackets if it's not required
|
// Wrap with square brackets if it's not required
|
||||||
Flags\is_flag_set(Input\AbstractInputType::FLAG_OPTIONAL, $a->flags()) ||
|
Flags\is_flag_set(Input\AbstractInputType::FLAG_OPTIONAL, $a->flags()) ||
|
||||||
|
|
@ -102,12 +102,17 @@ if (!function_exists(__NAMESPACE__.'manpage')) {
|
||||||
$arguments = [];
|
$arguments = [];
|
||||||
$options = [];
|
$options = [];
|
||||||
|
|
||||||
foreach ($collection->getArguments() as $a) {
|
foreach ($collection->getItemsByType("Argument") as $a) {
|
||||||
$arguments[] = (string) $a;
|
$arguments[] = (string) $a;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($collection->getOptions() as $o) {
|
foreach($collection->getTypes() as $type) {
|
||||||
$options[] = (string) $o;
|
if($type == 'Argument') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach ($collection->getItemsByType($type) as $o) {
|
||||||
|
$options[] = (string) $o;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the arguments, if there are any.
|
// Add the arguments, if there are any.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue