diff options
| author | Matthias Clasen <mclasen@redhat.com> | 2019-01-21 14:39:08 -0500 |
|---|---|---|
| committer | Atomic Bot <atomic-devel@projectatomic.io> | 2019-01-23 12:45:00 +0000 |
| commit | 370c667887a810fb28df392f4c8e4418ebb8b1a2 (patch) | |
| tree | 03a57831b95de356da98f975bf15e749f7571dde | |
| parent | 7ec898f00b0aeadca04559aa3eb71b1bfbb3352a (diff) | |
| download | flatpak-370c667887a810fb28df392f4c8e4418ebb8b1a2.tar.gz | |
columns: Be more precise and helpful
Complain about ambiguous suffixes, and and spell out
the allowed values when complaining about suffixes.
Closes: #2624
Approved by: matthiasclasen
| -rw-r--r-- | app/flatpak-builtins-utils.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/app/flatpak-builtins-utils.c b/app/flatpak-builtins-utils.c index 7e7844b3..8a09006d 100644 --- a/app/flatpak-builtins-utils.c +++ b/app/flatpak-builtins-utils.c @@ -824,7 +824,14 @@ parse_ellipsize_suffix (const char *p, FlatpakEllipsizeMode *mode, GError **error) { - if (g_str_has_prefix (":full", p)) + if (g_str_equal (":", p)) + { + g_autofree char *msg1 = g_strdup_printf (_("Ambiguous suffix: '%s'."), p); + /* Translators: don't translate the values */ + const char *msg2 = _("Possible values are :s[tart], :m[iddle], :e[nd] or :f[ull]"); + return flatpak_fail (error, "%s %s", msg1, msg2); + } + else if (g_str_has_prefix (":full", p)) *mode = FLATPAK_ELLIPSIZE_MODE_NONE; else if (g_str_has_prefix (":start", p)) *mode = FLATPAK_ELLIPSIZE_MODE_START; @@ -833,7 +840,12 @@ parse_ellipsize_suffix (const char *p, else if (g_str_has_prefix (":end", p)) *mode = FLATPAK_ELLIPSIZE_MODE_END; else - return flatpak_fail (error, "'%s' does not specify an ellipsization", p); + { + g_autofree char *msg1 = g_strdup_printf (_("Invalid suffix: '%s'."), p); + /* Translators: don't translate the values */ + const char *msg2 = _("Possible values are :s[tart], :m[iddle], :e[nd] or :f[ull]"); + return flatpak_fail (error, "%s %s", msg1, msg2); + } return TRUE; } |
