Make vitastor-cli print help on missing command

rm-left-on-dead
Vitaliy Filippov 2022-12-25 02:20:52 +03:00
parent 2f3c2c5140
commit 0d8625f92d
1 changed files with 4 additions and 4 deletions

View File

@ -149,10 +149,6 @@ static json11::Json::object parse_args(int narg, const char *args[])
cmd.push_back(std::string(args[i]));
}
}
if (cfg["help"].bool_value())
{
print_help(help_text, "vitastor-cli", cmd.size() ? cmd[0].string_value() : "", cfg["all"].bool_value());
}
if (!cmd.size())
{
std::string exe(exe_name);
@ -161,6 +157,10 @@ static json11::Json::object parse_args(int narg, const char *args[])
cmd.push_back("rm-data");
}
}
if (!cmd.size() || cfg["help"].bool_value())
{
print_help(help_text, "vitastor-cli", cmd.size() ? cmd[0].string_value() : "", cfg["all"].bool_value());
}
cfg["command"] = cmd;
return cfg;
}