mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
virsh: Do not make interactive mode default
Currently, we set interactive mode as default possibly reverting the setting after we parse the command line arguments. There's nothing particulary wrong with that, but a call to vshReadlineInit is performed always in the global initializer just because the default mode is interactive. Rather than moving vshReadlineInit call somewhere else (because another client might want to implement interactive mode only), we could make the decision if we're about to run in interactive mode once the command line is parsed.
This commit is contained in:
parent
f59d51f518
commit
a02de849a0
@ -787,7 +787,9 @@ virshParseArgv(vshControl *ctl, int argc, char **argv)
|
||||
longindex = -1;
|
||||
}
|
||||
|
||||
if (argc > optind) {
|
||||
if (argc == optind) {
|
||||
ctl->imode = true;
|
||||
} else {
|
||||
/* parse command */
|
||||
ctl->imode = false;
|
||||
if (argc - optind == 1) {
|
||||
@ -847,7 +849,6 @@ main(int argc, char **argv)
|
||||
memset(ctl, 0, sizeof(vshControl));
|
||||
memset(&virshCtl, 0, sizeof(virshControl));
|
||||
ctl->name = "virsh"; /* hardcoded name of the binary */
|
||||
ctl->imode = true; /* default is interactive mode */
|
||||
ctl->log_fd = -1; /* Initialize log file descriptor */
|
||||
ctl->debug = VSH_DEBUG_DEFAULT;
|
||||
ctl->hooks = &hooks;
|
||||
|
Loading…
Reference in New Issue
Block a user