summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2016-06-24 18:56:36 +0200
committerLubomir Rintel <lkundrak@v3.sk>2016-06-29 20:49:34 +0200
commit1e582f0172f9cc4367a81af524307722aba51c26 (patch)
tree5e596b16213fd7a930aeb99e366af57894067cbe
parente2fe0eeb18f7539fc43621cb6438244e7e7d6a17 (diff)
downloadNetworkManager-1e582f0172f9cc4367a81af524307722aba51c26.tar.gz
cli: add boolean value completion helper
-rw-r--r--clients/cli/common.c14
-rw-r--r--clients/cli/common.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/clients/cli/common.c b/clients/cli/common.c
index 6c7a6dc46b..fc2245cbd1 100644
--- a/clients/cli/common.c
+++ b/clients/cli/common.c
@@ -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);
+}
diff --git a/clients/cli/common.h b/clients/cli/common.h
index eacd20eb44..3910683dc5 100644
--- a/clients/cli/common.h
+++ b/clients/cli/common.h
@@ -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 */