cli: multiline mode is default for 'dev list' and 'con list id|uuid'

Option '--multiline' was replaced with '--mode tabular|multiline'.
It was neccessary to be able to switch to tabular output mode for
'dev list' and 'con list id|uuid' commands as they now print out
in multiline mode by default. All other commands are in tabular
mode by default.
This commit is contained in:
Jiří Klimeš
2010-04-06 16:22:01 +02:00
parent 3ccd948f3a
commit 87bf00b3d7
4 changed files with 24 additions and 3 deletions

View File

@@ -66,7 +66,7 @@ usage (const char *prog_name)
"OPTIONS\n"
" -t[erse] terse output\n"
" -p[retty] pretty output\n"
" -m[ultiline] multiline output\n"
" -m[ode] tabular|multiline output mode\n"
" -f[ields] <field1,field2,...>|all|common specify fields to output\n"
" -e[scape] yes|no escape columns separators in values\n"
" -v[ersion] show program version\n"
@@ -160,8 +160,23 @@ parse_command_line (NmCli *nmc, int argc, char **argv)
}
else
nmc->print_output = NMC_PRINT_PRETTY;
} else if (matches (opt, "-multiline") == 0) {
nmc->multiline_output = TRUE;
} else if (matches (opt, "-mode") == 0) {
nmc->mode_specified = TRUE;
next_arg (&argc, &argv);
if (argc <= 1) {
g_string_printf (nmc->return_text, _("Error: missing argument for '%s' option."), opt);
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
return nmc->return_value;
}
if (!strcmp (argv[1], "tabular"))
nmc->multiline_output = FALSE;
else if (!strcmp (argv[1], "multiline"))
nmc->multiline_output = TRUE;
else {
g_string_printf (nmc->return_text, _("Error: '%s' is not valid argument for '%s' option."), argv[1], opt);
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
return nmc->return_value;
}
} else if (matches (opt, "-escape") == 0) {
next_arg (&argc, &argv);
if (argc <= 1) {
@@ -269,6 +284,7 @@ nmc_init (NmCli *nmc)
nmc->should_wait = FALSE;
nmc->print_output = NMC_PRINT_NORMAL;
nmc->multiline_output = FALSE;
nmc->mode_specified = FALSE;
nmc->escape_values = TRUE;
nmc->required_fields = NULL;
nmc->allowed_fields = NULL;