nmcli: reword error message for a wrong user input in edit mode

Before, when specifying a setting.property with missing property name,
the following happened:

  nmcli> set connection.
  Error: invalid property: '' not among [...

Reword this special error case of a missing property to make it more
clear.

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller
2013-09-05 19:16:12 +02:00
parent 1111dbf812
commit f6703f540c

View File

@@ -483,8 +483,14 @@ nmc_string_is_valid (const char *input, const char **allowed, GError **error)
finish:
if (ret == NULL) {
char *valid_vals = g_strjoinv (", ", (char **) allowed);
g_set_error (error, 1, 0, _("'%s' not among [%s]"),
input ? input : "", valid_vals);
if (!input || !*input) {
g_set_error (error, 1, 0, _("missing name, try one of [%s]"),
valid_vals);
} else {
g_set_error (error, 1, 0, _("'%s' not among [%s]"),
input ? input : "", valid_vals);
}
g_free (valid_vals);
}
return ret;