c21ff38b8fda0584208ffd697dac0502e2327466

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(docker): remove unwanted asterisk in completed docker commands

Also update upstream completion to version fe2008d04e80fafd.

NOTE: this fix means the version bundled within Oh My Zsh has diverged
from the upstream version.

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/docker/_docker b/plugins/docker/_docker
  2index 7fe2043132b6808949263750550814362dcfa327..8ee35abcfc4b5d0a1487972d84a869057f3c03a4 100644
  3--- a/plugins/docker/_docker
  4+++ b/plugins/docker/_docker
  5@@ -1343,7 +1343,7 @@ __docker_node_complete_ls_filters() {
  6                 ;;
  7         esac
  8     else
  9-        opts=('id' 'label' 'membership' 'name' 'role')
 10+        opts=('id' 'label' 'membership' 'name' 'node.label' 'role')
 11         _describe -t filter-opts "filter options" opts -qS "=" && ret=0
 12     fi
 13 
 14@@ -2544,6 +2544,82 @@ __docker_volume_subcommand() {
 15 
 16 # EO volume
 17 
 18+# BO context
 19+
 20+__docker_complete_contexts() {
 21+    [[ $PREFIX = -* ]] && return 1
 22+    integer ret=1
 23+    declare -a contexts
 24+
 25+    contexts=(${(f)${:-"$(_call_program commands docker $docker_options context ls -q)"$'\n'}})
 26+
 27+    _describe -t context-list "context" contexts && ret=0
 28+    return ret
 29+}
 30+
 31+__docker_context_commands() {
 32+    local -a _docker_context_subcommands
 33+    _docker_context_subcommands=(
 34+        "create:Create new context"
 35+        "inspect:Display detailed information on one or more contexts"
 36+        "list:List available contexts"
 37+        "rm:Remove one or more contexts"
 38+        "show:Print the current context"
 39+        "update:Update a context"
 40+        "use:Set the default context"
 41+    )
 42+    _describe -t docker-context-commands "docker context command" _docker_context_subcommands
 43+}
 44+
 45+__docker_context_subcommand() {
 46+    local -a _command_args opts_help
 47+    local expl help="--help"
 48+    integer ret=1
 49+
 50+    opts_help=("(: -)--help[Print usage]")
 51+
 52+    case "$words[1]" in
 53+        (create)
 54+            _arguments $(__docker_arguments) \
 55+                $opts_help \
 56+                "($help)--default-stack-orchestrator=[Default orchestrator for stack operations to use with this context]:default-stack-orchestrator:(swarm kubernetes all)" \
 57+                "($help)--description=[Description of the context]:description:" \
 58+                "($help)--docker=[Set the docker endpoint]:docker:" \
 59+                "($help)--kubernetes=[Set the kubernetes endpoint]:kubernetes:" \
 60+                "($help)--from=[Create context from a named context]:from:__docker_complete_contexts" \
 61+                "($help -):name: " && ret=0
 62+            ;;
 63+        (use)
 64+            _arguments $(__docker_arguments) \
 65+                $opts_help \
 66+                "($help -)1:context:__docker_complete_contexts" && ret=0
 67+            ;;
 68+        (inspect)
 69+            _arguments $(__docker_arguments) \
 70+                $opts_help \
 71+                "($help -)1:context:__docker_complete_contexts" && ret=0
 72+            ;;
 73+        (rm)
 74+            _arguments $(__docker_arguments) \
 75+                $opts_help \
 76+                "($help -)1:context:__docker_complete_contexts" && ret=0
 77+            ;;
 78+        (update)
 79+            _arguments $(__docker_arguments) \
 80+                $opts_help \
 81+                "($help)--default-stack-orchestrator=[Default orchestrator for stack operations to use with this context]:default-stack-orchestrator:(swarm kubernetes all)" \
 82+                "($help)--description=[Description of the context]:description:" \
 83+                "($help)--docker=[Set the docker endpoint]:docker:" \
 84+                "($help)--kubernetes=[Set the kubernetes endpoint]:kubernetes:" \
 85+                "($help -):name:" && ret=0
 86+            ;;
 87+    esac
 88+
 89+    return ret
 90+}
 91+
 92+# EO context
 93+
 94 __docker_caching_policy() {
 95   oldp=( "$1"(Nmh+1) )     # 1 hour
 96   (( $#oldp ))
 97@@ -2576,7 +2652,7 @@ __docker_commands() {
 98     then
 99         local -a lines
100         lines=(${(f)"$(_call_program commands docker 2>&1)"})
101-        _docker_subcommands=(${${${(M)${lines[$((${lines[(i)*Commands:]} + 1)),-1]}:# *}## #}/ ##/:})
102+        _docker_subcommands=(${${${(M)${lines[$((${lines[(i)*Commands:]} + 1)),-1]}:# *}## #}/\*# ##/:})
103         _docker_subcommands=($_docker_subcommands 'daemon:Enable daemon mode' 'help:Show help for a command')
104         (( $#_docker_subcommands > 2 )) && _store_cache docker_subcommands _docker_subcommands