cli: add '--ask' global option

It will be used to ask user for required but missing data/parameters.
This commit is contained in:
Jiří Klimeš
2012-11-21 13:10:31 +01:00
committed by Dan Williams
parent abbde8d76f
commit 981a687f77
2 changed files with 5 additions and 0 deletions

View File

@@ -82,6 +82,7 @@ usage (const char *prog_name)
" -f[ields] <field1,field2,...>|all|common specify fields to output\n"
" -e[scape] yes|no escape columns separators in values\n"
" -n[ocheck] don't check nmcli and NetworkManager versions\n"
" -a[sk] ask for missing parameters\n"
" -v[ersion] show program version\n"
" -h[elp] print this help\n"
"\n"
@@ -220,6 +221,8 @@ parse_command_line (NmCli *nmc, int argc, char **argv)
nmc->required_fields = g_strdup (argv[1]);
} else if (matches (opt, "-nocheck") == 0) {
nmc->nocheck_ver = TRUE;
} else if (matches (opt, "-ask") == 0) {
nmc->ask = TRUE;
} else if (matches (opt, "-version") == 0) {
printf (_("nmcli tool, version %s\n"), NMCLI_VERSION);
return NMC_RESULT_SUCCESS;
@@ -305,6 +308,7 @@ nmc_init (NmCli *nmc)
nmc->allowed_fields = NULL;
memset (&nmc->print_fields, '\0', sizeof (NmcPrintFields));
nmc->nocheck_ver = FALSE;
nmc->ask = FALSE;
}
static void