mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-67687 cli: Make boolean CLI args negatable
This commit is contained in:
parent
07238ca511
commit
b0e096d870
@ -105,6 +105,12 @@ function cli_get_params(array $longoptions, array $shortmapping=null) {
|
||||
if (count($parts) == 1) {
|
||||
$key = reset($parts);
|
||||
$value = true;
|
||||
|
||||
if (substr($key, 0, 3) === 'no-') {
|
||||
// Support flipping the boolean value.
|
||||
$value = !$value;
|
||||
$key = substr($key, 3);
|
||||
}
|
||||
} else {
|
||||
$key = array_shift($parts);
|
||||
$value = implode('=', $parts);
|
||||
|
Loading…
x
Reference in New Issue
Block a user