diff options
| author | Michael Biebl <biebl@debian.org> | 2020-07-13 22:06:54 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2020-07-13 22:06:54 +0200 |
| commit | c954a7079d01d0e5fad9c8ad99d8891d9e6f5bed (patch) | |
| tree | 3f24a6356fc531498ec6b091a67230eaf725145d /clients/cli/utils.h | |
| parent | 36f77b6d9a724e4bc8e219b15fe446cd3a5e0099 (diff) | |
| parent | 136d191f1c96dbae1489fed7c2565f5e1b1f8d40 (diff) | |
Update upstream source from tag 'upstream/1.26.0'
Update to upstream version '1.26.0' with Debian dir ac612e9c69962647563dd4d6aa7499aacaf8aa3c
Diffstat (limited to 'clients/cli/utils.h')
| -rw-r--r-- | clients/cli/utils.h | 18 |
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); |