diff --git a/tools/virsh.c b/tools/virsh.c index 7477d322a3..032c8bf4ae 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -19896,7 +19896,6 @@ vshAllowedEscapeChar(char c) static bool vshParseArgv(vshControl *ctl, int argc, char **argv) { - bool help = false; int arg, len; struct option opt[] = { {"debug", required_argument, NULL, 'd'}, @@ -19923,7 +19922,8 @@ vshParseArgv(vshControl *ctl, int argc, char **argv) } break; case 'h': - help = true; + vshUsage(); + exit(EXIT_SUCCESS); break; case 'q': ctl->quiet = true; @@ -19968,17 +19968,6 @@ vshParseArgv(vshControl *ctl, int argc, char **argv) } } - if (help) { - if (optind < argc) { - vshError(ctl, _("extra argument '%s'. See --help."), argv[optind]); - exit(EXIT_FAILURE); - } - - /* list all command */ - vshUsage(); - exit(EXIT_SUCCESS); - } - if (argc > optind) { /* parse command */ ctl->imode = false;