Commit f0c6a031 authored by Beniamino Galvani's avatar Beniamino Galvani

cli: prefer 'modify' over 'monitor' when the command is abbreviated

In previous releases 'nmcli connection m' was interpreted as 'modify',
but recently the monitor command was introduced with a higher
priority, changing the behavior when the abbreviated form is
used.

Restore the old behavior.

https://bugzilla.redhat.com/show_bug.cgi?id=1316120
parent 551c5de1
......@@ -11123,8 +11123,6 @@ do_connections (NmCli *nmc, int argc, char **argv)
g_thread_unref (editor_thread);
} else if (matches(*argv, "delete") == 0) {
nmc->return_value = do_connection_delete (nmc, argc-1, argv+1);
} else if (matches(*argv, "monitor") == 0) {
nmc->return_value = do_connection_monitor (nmc, argc-1, argv+1);
} else if (matches(*argv, "reload") == 0) {
nmc->return_value = do_connection_reload (nmc, argc-1, argv+1);
} else if (matches(*argv, "load") == 0) {
......@@ -11158,6 +11156,8 @@ do_connections (NmCli *nmc, int argc, char **argv)
nmc->return_value = do_connection_import (nmc, temporary, argc, argv);
} else if (matches(*argv, "export") == 0) {
nmc->return_value = do_connection_export (nmc, argc-1, argv+1);
} else if (matches(*argv, "monitor") == 0) {
nmc->return_value = do_connection_monitor (nmc, argc-1, argv+1);
} else {
usage ();
g_string_printf (nmc->return_text, _("Error: '%s' is not valid 'connection' command."), *argv);
......
......@@ -1325,7 +1325,7 @@ _nmcli()
;;
de|del|dele|delet|delete| \
m|mo|mon|moni|monit|monito|monitor)
mon|moni|monit|monito|monitor)
if [[ ${#words[@]} -eq 3 ]]; then
_nmcli_compl_COMMAND_nl "${words[2]}" "$(printf "id\nuuid\npath\n%s" "$(_nmcli_con_show NAME)")"
elif [[ ${#words[@]} -gt 3 ]]; then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment