cli: add boolean value completion helper

This commit is contained in:
Lubomir Rintel 2016-06-24 18:56:36 +02:00
parent e2fe0eeb18
commit 1e582f0172
2 changed files with 16 additions and 0 deletions

View file

@ -1464,3 +1464,17 @@ nmc_complete_strings (const char *prefix, ...)
}
va_end (args);
}
/**
* nmc_complete_bool:
* @prefix: a string to match
* @...: a %NULL-terminated list of candidate strings
*
* Prints all the matching possible boolean values for completion.
*/
void
nmc_complete_bool (const char *prefix)
{
nmc_complete_strings (prefix, "true", "yes", "on",
"false", "no", "off", NULL);
}

View file

@ -83,4 +83,6 @@ NMCResultCode nmc_do_cmd (NmCli *nmc, const NMCCommand cmds[], const char *argv0
void nmc_complete_strings (const char *prefix, ...) G_GNUC_NULL_TERMINATED;
void nmc_complete_bool (const char *prefix);
#endif /* NMC_COMMON_H */