cli: prefer 'modify' over 'monitor' when the command is abbreviated
authorBeniamino Galvani <bgalvani@redhat.com>
Thu, 10 Mar 2016 09:18:41 +0000 (10:18 +0100)
committerBeniamino Galvani <bgalvani@redhat.com>
Thu, 10 Mar 2016 10:12:02 +0000 (11:12 +0100)
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

clients/cli/connections.c
clients/cli/nmcli-completion

index d465886..b42f14d 100644 (file)
@@ -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);
index f8c0298..7f79180 100644 (file)
@@ -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