about summary refs log tree commit diff
path: root/clients/cli/utils.h
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2020-07-27 17:03:33 +0200
committerSebastien Bacher <seb128@ubuntu.com>2020-07-27 17:03:33 +0200
commitb92fc658301eb82b80167a31179c9b839f151b18 (patch)
tree26e2203952eef4ee60e58c6904755e5508150a26 /clients/cli/utils.h
parent486e0bef719d78ee55d2166b0bfb4fa684c09854 (diff)
parent136d191f1c96dbae1489fed7c2565f5e1b1f8d40 (diff)
Merge branch 'upstream/latest' of https://salsa.debian.org/utopia-team/network-manager into upstream/latest
Diffstat (limited to 'clients/cli/utils.h')
-rw-r--r--clients/cli/utils.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/clients/cli/utils.h b/clients/cli/utils.h
index d7ad738f..02b81b70 100644
--- a/clients/cli/utils.h
+++ b/clients/cli/utils.h
@@ -289,6 +289,24 @@ nmc_meta_generic_get_str_i18n (const char *s, NMMetaAccessorGetType get_type)
 }
 
 static inline const char *
+nmc_meta_generic_get_str_i18n_null (const char *s, NMMetaAccessorGetType get_type)
+{
+	if (get_type == NM_META_ACCESSOR_GET_TYPE_PARSABLE) {
+		/* in parsable mode, return NULL. That is useful if @s is a pretty string
+		 * to describe a missing value (like "(unknown)"). We don't want to print
+		 * that for parsable mode. */
+		return NULL;
+	}
+	return nmc_meta_generic_get_str_i18n (s, get_type);
+}
+
+static inline const char *
+nmc_meta_generic_get_unknown (NMMetaAccessorGetType get_type)
+{
+	return nmc_meta_generic_get_str_i18n_null (N_("(unknown)"), get_type);
+}
+
+static inline const char *
 nmc_meta_generic_get_bool (gboolean val, NMMetaAccessorGetType get_type)
 {
 	return nmc_meta_generic_get_str_i18n (val ? N_("yes") : N_("no"), get_type);