mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 16:37:02 +03:00
Improved imapsync.php options detection
This commit is contained in:
parent
2e3e1fa5fe
commit
3012084184
1 changed files with 6 additions and 4 deletions
|
|
@ -100,16 +100,18 @@ function get_opt(string $short_options, array $long_options) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// When empty, prompt on command line for value
|
// When empty, prompt on command line for value
|
||||||
if (($required || $optional) && isset($opts[$key]) && !\strlen($opts[$key])) {
|
if (($required && empty($opts[$key]))
|
||||||
|
|| ($optional && isset($opts[$key]) && !\strlen($opts[$key]))
|
||||||
|
) {
|
||||||
if (\is_callable('readline')) {
|
if (\is_callable('readline')) {
|
||||||
$opts[$key] = \readline("{$key}: ");
|
$opts[$key] = \readline("{$key}: ");
|
||||||
} else {
|
} else {
|
||||||
echo "{$key}: ";
|
echo "{$key}: ";
|
||||||
$opts[$key] = \stream_get_line(STDIN, 1024, PHP_EOL);
|
$opts[$key] = \stream_get_line(STDIN, 1024, PHP_EOL);
|
||||||
}
|
}
|
||||||
}
|
if ($required && empty($opts[$key])) {
|
||||||
if ($required && !isset($opts[$key])) {
|
exit("Missing required argument {$arg}");
|
||||||
exit("Missing required argument {$arg}");
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $opts;
|
return $opts;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue