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:
@@ -483,8 +483,14 @@ nmc_string_is_valid (const char *input, const char **allowed, GError **error)
|
|||||||
finish:
|
finish:
|
||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
char *valid_vals = g_strjoinv (", ", (char **) allowed);
|
char *valid_vals = g_strjoinv (", ", (char **) allowed);
|
||||||
|
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]"),
|
g_set_error (error, 1, 0, _("'%s' not among [%s]"),
|
||||||
input ? input : "", valid_vals);
|
input ? input : "", valid_vals);
|
||||||
|
}
|
||||||
|
|
||||||
g_free (valid_vals);
|
g_free (valid_vals);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
Reference in New Issue
Block a user