mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 15:34:04 +00:00
Write docs, add support for = in arg/opt value
This commit is contained in:
parent
5e34c2c6a4
commit
ccba8e43dc
3 changed files with 17 additions and 8 deletions
|
|
@ -41,17 +41,17 @@ class Run extends Command
|
|||
|
||||
$callback = function ($prefix = '') {
|
||||
return function ($arguments, $argument) use ($prefix) {
|
||||
[$key, $value] = explode('=', $argument);
|
||||
[$key, $value] = explode('=', $argument, 2);
|
||||
$arguments[$prefix . $key] = $value;
|
||||
|
||||
return $arguments;
|
||||
};
|
||||
};
|
||||
|
||||
// Turns ['foo=bar', 'abc=xyz'] into ['foo' => 'bar', 'abc' => 'xyz']
|
||||
// Turns ['foo=bar', 'abc=xyz=zzz'] into ['foo' => 'bar', 'abc' => 'xyz=zzz']
|
||||
$arguments = array_reduce($this->option('argument'), $callback(), []);
|
||||
|
||||
// Turns ['foo=bar', 'abc=xyz'] into ['--foo' => 'bar', '--abc' => 'xyz']
|
||||
// Turns ['foo=bar', 'abc=xyz=zzz'] into ['--foo' => 'bar', '--abc' => 'xyz=zzz']
|
||||
$options = array_reduce($this->option('option'), $callback('--'), []);
|
||||
|
||||
// Run command
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue