summaryrefslogtreecommitdiff
path: root/clients/cli/nmcli-completion
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2015-11-05 12:03:49 +0100
committerJiří Klimeš <jklimes@redhat.com>2015-11-06 13:00:17 +0100
commit7377459e4750b1d58344c6e01a7ab5cb926aaeb4 (patch)
tree3880270a91676e7c5bf566162f5ca9149022b4e0 /clients/cli/nmcli-completion
parentb9da3d93207e46de895fd07cfe9de1edfa79efef (diff)
downloadNetworkManager-jk/nmcli-con-clone.tar.gz
cli: add ' nmcli connection clone' command for cloning connectionsjk/nmcli-con-clone
Synopsis: nmcli connection clone [--temporary] [id|uuid|path] <ID> <new name> It copies the <ID> connection as <new name>. The command is very useful if there is a connection, but another one is needed for a related configuration. One can copy the existing profile and modify it for the new situation. For example: $ nmcli con clone main-eth second-eth $ nmcli con mod second-eth connection.interface-name em4
Diffstat (limited to 'clients/cli/nmcli-completion')
-rw-r--r--clients/cli/nmcli-completion30
1 files changed, 29 insertions, 1 deletions
diff --git a/clients/cli/nmcli-completion b/clients/cli/nmcli-completion
index 6d9b6ae1cb..203a020716 100644
--- a/clients/cli/nmcli-completion
+++ b/clients/cli/nmcli-completion
@@ -863,7 +863,7 @@ _nmcli()
;;
c|co|con|conn|conne|connec|connect|connecti|connectio|connection)
if [[ ${#words[@]} -eq 2 ]]; then
- _nmcli_compl_COMMAND "$command" show up down add modify edit delete reload load
+ _nmcli_compl_COMMAND "$command" show up down add modify clone edit delete reload load
elif [[ ${#words[@]} -gt 2 ]]; then
case "$command" in
s|sh|sho|show)
@@ -1245,6 +1245,34 @@ _nmcli()
return 0
fi
;;
+ c|cl|clo|clon|clone)
+ if [[ ${#words[@]} -eq 3 ]]; then
+ _nmcli_compl_COMMAND_nl "${words[2]}" "$(printf "id\nuuid\npath\n%s" "$(_nmcli_con_show NAME)")" temporary
+ elif [[ ${#words[@]} -gt 3 ]]; then
+ _nmcli_array_delete_at words 0 1
+
+ LONG_OPTIONS=(help temporary)
+ HELP_ONLY_AS_FIRST=1
+ _nmcli_compl_OPTIONS
+ case $? in
+ 0)
+ return 0
+ ;;
+ 1)
+ if [[ "$HELP_ONLY_AS_FIRST" == 1 ]]; then
+ _nmcli_compl_COMMAND_nl "${words[2]}" "$(printf "id\nuuid\npath\n%s" "$(_nmcli_con_show NAME)")" "${LONG_OPTIONS[@]}"
+ fi
+ return 0
+ ;;
+ esac
+
+ OPTIONS=(id uuid path)
+ _nmcli_compl_ARGS_CONNECTION && return 0
+
+ return 0
+ fi
+ ;;
+
de|del|dele|delet|delete)
if [[ ${#words[@]} -eq 3 ]]; then
_nmcli_compl_COMMAND_nl "${words[2]}" "$(printf "id\nuuid\npath\n%s" "$(_nmcli_con_show NAME)")"