Commit c8974bc3 authored by Jiří Klimeš's avatar Jiří Klimeš

cli: allow more forms of "help" command showing OBJECTs' description

allow "-[h]elp" and "--[h]elp" in addition to "help"
parent c225a639
......@@ -197,7 +197,9 @@ usage (void)
" up id <id> | uuid <id> [iface <iface>] [ap <BSSID>] [--nowait] [--timeout <timeout>]\n"
#endif
" down id <id> | uuid <id>\n"
" delete id <id> | uuid <id>\n"));
" delete id <id> | uuid <id>\n"
"\n"
));
}
/* The real commands that do something - i.e. not 'help', etc. */
......@@ -1987,10 +1989,13 @@ parse_cmd (NmCli *nmc, int argc, char **argv)
else if (matches(*argv, "delete") == 0) {
nmc->return_value = do_connection_delete (nmc, argc-1, argv+1);
}
else if (matches (*argv, "help") == 0) {
else if ( matches (*argv, "help") == 0
|| (g_str_has_prefix (*argv, "-") && matches ((*argv)+1, "help") == 0)
|| (g_str_has_prefix (*argv, "--") && matches ((*argv)+2, "help") == 0)) {
usage ();
nmc->should_wait = FALSE;
} else {
}
else {
usage ();
g_string_printf (nmc->return_text, _("Error: 'con' command '%s' is not valid."), *argv);
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
......
......@@ -253,8 +253,9 @@ usage (void)
" wifi connect <(B)SSID> [password <password>] [wep-key-type key|phrase] [iface <iface>] [bssid <BSSID>] [name <name>]\n"
" [--private] [--nowait] [--timeout <timeout>]\n"
#if WITH_WIMAX
" wimax [list [iface <iface>] [nsp <name>]]\n\n"
" wimax [list [iface <iface>] [nsp <name>]]\n"
#endif
"\n"
));
}
......@@ -2104,10 +2105,13 @@ do_devices (NmCli *nmc, int argc, char **argv)
nmc->return_value = do_device_wimax (nmc, argc-1, argv+1);
}
#endif
else if (strcmp (*argv, "help") == 0) {
else if ( matches (*argv, "help") == 0
|| (g_str_has_prefix (*argv, "-") && matches ((*argv)+1, "help") == 0)
|| (g_str_has_prefix (*argv, "--") && matches ((*argv)+2, "help") == 0)) {
usage ();
}
else {
usage ();
g_string_printf (nmc->return_text, _("Error: 'dev' command '%s' is not valid."), *argv);
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
}
......
......@@ -578,10 +578,13 @@ do_network_manager (NmCli *nmc, int argc, char **argv)
}
}
#endif
else if (strcmp (*argv, "help") == 0) {
else if ( matches (*argv, "help") == 0
|| (g_str_has_prefix (*argv, "-") && matches ((*argv)+1, "help") == 0)
|| (g_str_has_prefix (*argv, "--") && matches ((*argv)+2, "help") == 0)) {
usage ();
}
else {
usage ();
g_string_printf (nmc->return_text, _("Error: 'nm' command '%s' is not valid."), *argv);
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment