Skip to content

Commit

Permalink
Fix command input generator
Browse files Browse the repository at this point in the history
  • Loading branch information
tkotosz committed Mar 29, 2019
1 parent 43b5e40 commit cdfbdb2
Showing 1 changed file with 10 additions and 4 deletions.
Expand Up @@ -45,16 +45,22 @@ private function createCommandInput(CreateCommandScheduleRequest $request): stri

// add options
foreach ($command->getDefinition()->getOptions() as $option) {
$paramName = '--' . $option->getName();
if (isset($commandParams[$paramName])) {
$input .= ' ' . $paramName . '=' . $commandParams[$paramName];
if (isset($commandParams[$option->getName()])) {
$input .= sprintf(
' --%s="%s"',
$option->getName(),
addcslashes($commandParams[$option->getName()], '"')
);
}
}

// add arguments
foreach ($command->getDefinition()->getArguments() as $argument) {
if (isset($commandParams[$argument->getName()])) {
$input .= ' ' . $commandParams[$argument->getName()];
$input .= sprintf(
' "%s"',
addcslashes($commandParams[$argument->getName()], '"')
);
}
}

Expand Down

0 comments on commit cdfbdb2

Please sign in to comment.