Skip to content

Commit

Permalink
fix: Fix to Create CLI Command
Browse files Browse the repository at this point in the history
  • Loading branch information
usernane committed Jul 2, 2024
1 parent 781a233 commit 82c7a88
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tests/webfiori/framework/test/cli/SchedulerCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function test05() {
"Skip"];
$actual = $runner->getOutput();
$idx = 0;
var_dump($actual);

foreach ($expected as $item) {
if ($item == 'Skip') {
break;
Expand Down
21 changes: 12 additions & 9 deletions webfiori/framework/cli/helpers/CreateCLIClassHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,21 @@ private function getArgs() : array {
$addToMore = true;

while ($addToMore) {
$argArr = [];
$groupName = $this->getInput('Enter argument name:');
$argObj = new \webfiori\cli\Argument();
$argName = $this->getInput('Enter argument name:');

if (strlen($groupName) > 0) {
$argArr['name'] = $groupName;
if (!$argObj->setName($argName)) {
$this->error('Invalid name provided.');
continue;
}
$argArr['description'] = $this->getInput('Describe this argument and how to use it:', '');
$argArr['values'] = $this->getFixedValues();
$argArr['optional'] = $this->confirm('Is this argument optional or not?', true);
$argArr['default'] = $this->getInput('Enter default value:');
$argObj->setDescription($this->getInput('Describe this argument and how to use it:', ''));
foreach ($this->getFixedValues() as $v) {
$argObj->addAllowedValue($v);
}
$argObj->setIsOptional($this->confirm('Is this argument optional or not?', true));
$argObj->setDefault($this->getInput('Enter default value:').'');

$argsArr[] = $argArr;
$argsArr[] = $argObj;
$addToMore = $this->confirm('Would you like to add more arguments?', false);
}

Expand Down

0 comments on commit 82c7a88

Please sign in to comment.