cli: allow more forms of "help" command showing OBJECTs' description
allow "-[h]elp" and "--[h]elp" in addition to "help"
This commit is contained in:
@@ -197,7 +197,9 @@ usage (void)
|
|||||||
" up id <id> | uuid <id> [iface <iface>] [ap <BSSID>] [--nowait] [--timeout <timeout>]\n"
|
" up id <id> | uuid <id> [iface <iface>] [ap <BSSID>] [--nowait] [--timeout <timeout>]\n"
|
||||||
#endif
|
#endif
|
||||||
" down id <id> | uuid <id>\n"
|
" 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. */
|
/* 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) {
|
else if (matches(*argv, "delete") == 0) {
|
||||||
nmc->return_value = do_connection_delete (nmc, argc-1, argv+1);
|
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 ();
|
usage ();
|
||||||
nmc->should_wait = FALSE;
|
nmc->should_wait = FALSE;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
usage ();
|
usage ();
|
||||||
g_string_printf (nmc->return_text, _("Error: 'con' command '%s' is not valid."), *argv);
|
g_string_printf (nmc->return_text, _("Error: 'con' command '%s' is not valid."), *argv);
|
||||||
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
|
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"
|
" wifi connect <(B)SSID> [password <password>] [wep-key-type key|phrase] [iface <iface>] [bssid <BSSID>] [name <name>]\n"
|
||||||
" [--private] [--nowait] [--timeout <timeout>]\n"
|
" [--private] [--nowait] [--timeout <timeout>]\n"
|
||||||
#if WITH_WIMAX
|
#if WITH_WIMAX
|
||||||
" wimax [list [iface <iface>] [nsp <name>]]\n\n"
|
" wimax [list [iface <iface>] [nsp <name>]]\n"
|
||||||
#endif
|
#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);
|
nmc->return_value = do_device_wimax (nmc, argc-1, argv+1);
|
||||||
}
|
}
|
||||||
#endif
|
#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 ();
|
usage ();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
usage ();
|
||||||
g_string_printf (nmc->return_text, _("Error: 'dev' command '%s' is not valid."), *argv);
|
g_string_printf (nmc->return_text, _("Error: 'dev' command '%s' is not valid."), *argv);
|
||||||
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
|
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
|
||||||
}
|
}
|
||||||
|
@@ -578,10 +578,13 @@ do_network_manager (NmCli *nmc, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#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 ();
|
usage ();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
usage ();
|
||||||
g_string_printf (nmc->return_text, _("Error: 'nm' command '%s' is not valid."), *argv);
|
g_string_printf (nmc->return_text, _("Error: 'nm' command '%s' is not valid."), *argv);
|
||||||
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
|
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user