summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Giudici <fgiudici@redhat.com>2017-01-17 14:20:56 +0100
committerFrancesco Giudici <fgiudici@redhat.com>2017-01-17 14:22:35 +0100
commitc52aef1914b0188b2d88077373c9bec6b071a259 (patch)
tree2d4435a733aa0e33114ce0701c9104e9ff46876a
parent887f1c7d111e536eacf90edbbf74b33b88173a1d (diff)
downloadNetworkManager-fg/nmcli_parsing_rh1391170_wip.tar.gz
nmcli: add -g[et-vars] as -t -f <arg> shortcutfg/nmcli_parsing_rh1391170_wip
-rw-r--r--clients/cli/nmcli.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/clients/cli/nmcli.c b/clients/cli/nmcli.c
index 127ec542ac..a02cc8a791 100644
--- a/clients/cli/nmcli.c
+++ b/clients/cli/nmcli.c
@@ -186,6 +186,7 @@ usage (void)
" -m[ode] tabular|multiline output mode\n"
" -c[olors] auto|yes|no whether to use colors in output\n"
" -f[ields] <field1,field2,...>|all|common specify fields to output\n"
+ " -g[et-vars] <field1,field2,...>|all|common shortcut for -t -f <args>\n"
" -e[scape] yes|no escape columns separators in values\n"
" -a[sk] ask for missing parameters\n"
" -s[how-secrets] allow displaying passwords\n"
@@ -241,7 +242,7 @@ process_command_line (NmCli *nmc, int argc, char **argv)
if (argc == 1 && nmc->complete) {
nmc_complete_strings (opt, "--terse", "--pretty", "--mode", "--colors", "--escape",
"--fields", "--nocheck", "--ask", "--show-secrets",
- "--wait", "--version", "--help", NULL);
+ "--get-vars", "--wait", "--version", "--help", NULL);
}
if (opt[1] == '-') {
@@ -345,6 +346,17 @@ process_command_line (NmCli *nmc, int argc, char **argv)
if (argc == 1 && nmc->complete)
complete_fields (argv[0]);
nmc->required_fields = g_strdup (argv[0]);
+ } else if (matches (opt, "-get-vars") == 0) {
+ if (next_arg (&argc, &argv) != 0) {
+ g_string_printf (nmc->return_text, _("Error: fields for '%s' options are missing."), opt);
+ nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
+ return FALSE;
+ }
+ if (argc == 1 && nmc->complete)
+ complete_fields (argv[0]);
+ nmc->required_fields = g_strdup (argv[0]);
+ nmc->print_output = NMC_PRINT_TERSE;
+ nmc->mode_specified = TRUE;
} else if (matches (opt, "-nocheck") == 0) {
/* ignore for backward compatibility */
} else if (matches (opt, "-ask") == 0) {