Skip to content

Commit

Permalink
help adjustments, arg adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
dvnc0 committed Aug 25, 2023
1 parent 47a50c5 commit 99c2076
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/App/Core/Command_Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public function buildCommandData(Request $Request, Application_Object $Applicati
$cli_params[$arg->title] = $arg->default_value;
}
}

return [$command, $cli_params];
}

Expand Down
8 changes: 8 additions & 0 deletions src/App/Core/Request_Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ protected function getArgumentsPassed(array $argv): array {
return $args_out;
}

if (strpos($argv_mutated[0], '-') === false) {
$argv_mutated = array_slice($argv_mutated, 1, (count($argv) - 1));
}

if(empty($argv_mutated)) {
return $args_out;
}

$current_arg = NULL;
$ignore_key = FALSE;
for ($key = 0; $key <= (count($argv_mutated) - 1); $key++) {
Expand Down
6 changes: 3 additions & 3 deletions src/App/Tools/Help.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ public function buildCommandHelpOutput(Command_Object $command, Application_Obje
foreach($command->args as $arg) {
$value = $arg->is_flag ? '' : '=[VALUE]';
$rows[] = [
'--' . $arg->long_name . $value,
'-' . $arg->short_name . $value,
$arg->help,
isset($arg->long_name) ? '--' . $arg->long_name . $value : '',
isset($arg->short_name) ? '-' . $arg->short_name . $value : '',
isset($arg->help) ? $arg->help : '',
$arg->required ? 'True' : 'False',
$arg->is_flag ? 'True' : 'False',
];
Expand Down

0 comments on commit 99c2076

Please sign in to comment.