Change-Id: I6ceb5ea8f6b6cce50cbecd35baf4719ad62184e1
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/1609
Reviewed-by: Sharath George
Tested-by: gerrit-photon <photon-checkins@vmware.com>
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,2978 @@ |
| 0 |
+#!/bin/bash |
|
| 1 |
+# |
|
| 2 |
+# bash completion file for core docker commands |
|
| 3 |
+# |
|
| 4 |
+# This script provides completion of: |
|
| 5 |
+# - commands and their options |
|
| 6 |
+# - container ids and names |
|
| 7 |
+# - image repos and tags |
|
| 8 |
+# - filepaths |
|
| 9 |
+# |
|
| 10 |
+# To enable the completions either: |
|
| 11 |
+# - place this file in /etc/bash_completion.d |
|
| 12 |
+# or |
|
| 13 |
+# - copy this file to e.g. ~/.docker-completion.sh and add the line |
|
| 14 |
+# below to your .bashrc after bash completion features are loaded |
|
| 15 |
+# . ~/.docker-completion.sh |
|
| 16 |
+# |
|
| 17 |
+# Configuration: |
|
| 18 |
+# |
|
| 19 |
+# For several commands, the amount of completions can be configured by |
|
| 20 |
+# setting environment variables. |
|
| 21 |
+# |
|
| 22 |
+# DOCKER_COMPLETION_SHOW_NETWORK_IDS |
|
| 23 |
+# DOCKER_COMPLETION_SHOW_NODE_IDS |
|
| 24 |
+# DOCKER_COMPLETION_SHOW_SERVICE_IDS |
|
| 25 |
+# "no" - Show names only (default) |
|
| 26 |
+# "yes" - Show names and ids |
|
| 27 |
+# |
|
| 28 |
+# You can tailor completion for the "events", "history", "inspect", "run", |
|
| 29 |
+# "rmi" and "save" commands by settings the following environment |
|
| 30 |
+# variables: |
|
| 31 |
+# |
|
| 32 |
+# DOCKER_COMPLETION_SHOW_IMAGE_IDS |
|
| 33 |
+# "none" - Show names only (default) |
|
| 34 |
+# "non-intermediate" - Show names and ids, but omit intermediate image IDs |
|
| 35 |
+# "all" - Show names and ids, including intermediate image IDs |
|
| 36 |
+# |
|
| 37 |
+# DOCKER_COMPLETION_SHOW_TAGS |
|
| 38 |
+# "yes" - include tags in completion options (default) |
|
| 39 |
+# "no" - don't include tags in completion options |
|
| 40 |
+ |
|
| 41 |
+# |
|
| 42 |
+# Note: |
|
| 43 |
+# Currently, the completions will not work if the docker daemon is not |
|
| 44 |
+# bound to the default communication port/socket |
|
| 45 |
+# If the docker daemon is using a unix socket for communication your user |
|
| 46 |
+# must have access to the socket for the completions to function correctly |
|
| 47 |
+# |
|
| 48 |
+# Note for developers: |
|
| 49 |
+# Please arrange options sorted alphabetically by long name with the short |
|
| 50 |
+# options immediately following their corresponding long form. |
|
| 51 |
+# This order should be applied to lists, alternatives and code blocks. |
|
| 52 |
+ |
|
| 53 |
+__docker_previous_extglob_setting=$(shopt -p extglob) |
|
| 54 |
+shopt -s extglob |
|
| 55 |
+ |
|
| 56 |
+__docker_q() {
|
|
| 57 |
+ docker ${host:+-H "$host"} ${config:+--config "$config"} 2>/dev/null "$@"
|
|
| 58 |
+} |
|
| 59 |
+ |
|
| 60 |
+__docker_complete_containers_all() {
|
|
| 61 |
+ local IFS=$'\n' |
|
| 62 |
+ local containers=( $(__docker_q ps -aq --no-trunc) ) |
|
| 63 |
+ if [ "$1" ]; then |
|
| 64 |
+ containers=( $(__docker_q inspect --format "{{if $1}}{{.Id}}{{end}}" "${containers[@]}") )
|
|
| 65 |
+ fi |
|
| 66 |
+ local names=( $(__docker_q inspect --format '{{.Name}}' "${containers[@]}") )
|
|
| 67 |
+ names=( "${names[@]#/}" ) # trim off the leading "/" from the container names
|
|
| 68 |
+ unset IFS |
|
| 69 |
+ COMPREPLY=( $(compgen -W "${names[*]} ${containers[*]}" -- "$cur") )
|
|
| 70 |
+} |
|
| 71 |
+ |
|
| 72 |
+__docker_complete_containers_running() {
|
|
| 73 |
+ __docker_complete_containers_all '.State.Running' |
|
| 74 |
+} |
|
| 75 |
+ |
|
| 76 |
+__docker_complete_containers_stopped() {
|
|
| 77 |
+ __docker_complete_containers_all 'not .State.Running' |
|
| 78 |
+} |
|
| 79 |
+ |
|
| 80 |
+__docker_complete_containers_pauseable() {
|
|
| 81 |
+ __docker_complete_containers_all 'and .State.Running (not .State.Paused)' |
|
| 82 |
+} |
|
| 83 |
+ |
|
| 84 |
+__docker_complete_containers_unpauseable() {
|
|
| 85 |
+ __docker_complete_containers_all '.State.Paused' |
|
| 86 |
+} |
|
| 87 |
+ |
|
| 88 |
+__docker_complete_container_names() {
|
|
| 89 |
+ local containers=( $(__docker_q ps -aq --no-trunc) ) |
|
| 90 |
+ local names=( $(__docker_q inspect --format '{{.Name}}' "${containers[@]}") )
|
|
| 91 |
+ names=( "${names[@]#/}" ) # trim off the leading "/" from the container names
|
|
| 92 |
+ COMPREPLY=( $(compgen -W "${names[*]}" -- "$cur") )
|
|
| 93 |
+} |
|
| 94 |
+ |
|
| 95 |
+__docker_complete_container_ids() {
|
|
| 96 |
+ local containers=( $(__docker_q ps -aq) ) |
|
| 97 |
+ COMPREPLY=( $(compgen -W "${containers[*]}" -- "$cur") )
|
|
| 98 |
+} |
|
| 99 |
+ |
|
| 100 |
+__docker_complete_images() {
|
|
| 101 |
+ local images_args="" |
|
| 102 |
+ |
|
| 103 |
+ case "$DOCKER_COMPLETION_SHOW_IMAGE_IDS" in |
|
| 104 |
+ all) |
|
| 105 |
+ images_args="--no-trunc -a" |
|
| 106 |
+ ;; |
|
| 107 |
+ non-intermediate) |
|
| 108 |
+ images_args="--no-trunc" |
|
| 109 |
+ ;; |
|
| 110 |
+ esac |
|
| 111 |
+ |
|
| 112 |
+ local repo_print_command |
|
| 113 |
+ if [ "${DOCKER_COMPLETION_SHOW_TAGS:-yes}" = "yes" ]; then
|
|
| 114 |
+ repo_print_command='print $1; print $1":"$2' |
|
| 115 |
+ else |
|
| 116 |
+ repo_print_command='print $1' |
|
| 117 |
+ fi |
|
| 118 |
+ |
|
| 119 |
+ local awk_script |
|
| 120 |
+ case "$DOCKER_COMPLETION_SHOW_IMAGE_IDS" in |
|
| 121 |
+ all|non-intermediate) |
|
| 122 |
+ awk_script='NR>1 { print $3; if ($1 != "<none>") { '"$repo_print_command"' } }'
|
|
| 123 |
+ ;; |
|
| 124 |
+ none|*) |
|
| 125 |
+ awk_script='NR>1 && $1 != "<none>" { '"$repo_print_command"' }'
|
|
| 126 |
+ ;; |
|
| 127 |
+ esac |
|
| 128 |
+ |
|
| 129 |
+ local images=$(__docker_q images $images_args | awk "$awk_script") |
|
| 130 |
+ COMPREPLY=( $(compgen -W "$images" -- "$cur") ) |
|
| 131 |
+ __ltrim_colon_completions "$cur" |
|
| 132 |
+} |
|
| 133 |
+ |
|
| 134 |
+__docker_complete_image_repos() {
|
|
| 135 |
+ local repos="$(__docker_q images | awk 'NR>1 && $1 != "<none>" { print $1 }')"
|
|
| 136 |
+ COMPREPLY=( $(compgen -W "$repos" -- "$cur") ) |
|
| 137 |
+} |
|
| 138 |
+ |
|
| 139 |
+__docker_complete_image_repos_and_tags() {
|
|
| 140 |
+ local reposAndTags="$(__docker_q images | awk 'NR>1 && $1 != "<none>" { print $1; print $1":"$2 }')"
|
|
| 141 |
+ COMPREPLY=( $(compgen -W "$reposAndTags" -- "$cur") ) |
|
| 142 |
+ __ltrim_colon_completions "$cur" |
|
| 143 |
+} |
|
| 144 |
+ |
|
| 145 |
+__docker_complete_containers_and_images() {
|
|
| 146 |
+ __docker_complete_containers_all |
|
| 147 |
+ local containers=( "${COMPREPLY[@]}" )
|
|
| 148 |
+ __docker_complete_images |
|
| 149 |
+ COMPREPLY+=( "${containers[@]}" )
|
|
| 150 |
+} |
|
| 151 |
+ |
|
| 152 |
+# Returns the names and optionally IDs of networks. |
|
| 153 |
+# The selection can be narrowed by an optional filter parameter, e.g. 'type=custom' |
|
| 154 |
+__docker_networks() {
|
|
| 155 |
+ local filter="$1" |
|
| 156 |
+ # By default, only network names are completed. |
|
| 157 |
+ # Set DOCKER_COMPLETION_SHOW_NETWORK_IDS=yes to also complete network IDs. |
|
| 158 |
+ local fields='$2' |
|
| 159 |
+ [ "${DOCKER_COMPLETION_SHOW_NETWORK_IDS}" = yes ] && fields='$1,$2'
|
|
| 160 |
+ __docker_q network ls --no-trunc ${filter:+-f "$filter"} | awk "NR>1 {print $fields}"
|
|
| 161 |
+ #__docker_q network ls --no-trunc | awk "NR>1 {print $fields}"
|
|
| 162 |
+} |
|
| 163 |
+ |
|
| 164 |
+__docker_complete_networks() {
|
|
| 165 |
+ COMPREPLY=( $(compgen -W "$(__docker_networks $@)" -- "$cur") ) |
|
| 166 |
+} |
|
| 167 |
+ |
|
| 168 |
+__docker_complete_network_ids() {
|
|
| 169 |
+ COMPREPLY=( $(compgen -W "$(__docker_q network ls -q --no-trunc)" -- "$cur") ) |
|
| 170 |
+} |
|
| 171 |
+ |
|
| 172 |
+__docker_complete_network_names() {
|
|
| 173 |
+ COMPREPLY=( $(compgen -W "$(__docker_q network ls | awk 'NR>1 {print $2}')" -- "$cur") )
|
|
| 174 |
+} |
|
| 175 |
+ |
|
| 176 |
+__docker_complete_containers_in_network() {
|
|
| 177 |
+ local containers=$(__docker_q network inspect -f '{{range $i, $c := .Containers}}{{$i}} {{$c.Name}} {{end}}' "$1")
|
|
| 178 |
+ COMPREPLY=( $(compgen -W "$containers" -- "$cur") ) |
|
| 179 |
+} |
|
| 180 |
+ |
|
| 181 |
+__docker_complete_volumes() {
|
|
| 182 |
+ COMPREPLY=( $(compgen -W "$(__docker_q volume ls -q)" -- "$cur") ) |
|
| 183 |
+} |
|
| 184 |
+ |
|
| 185 |
+__docker_plugins() {
|
|
| 186 |
+ __docker_q info | sed -n "/^Plugins/,/^[^ ]/s/ $1: //p" |
|
| 187 |
+} |
|
| 188 |
+ |
|
| 189 |
+__docker_complete_plugins() {
|
|
| 190 |
+ COMPREPLY=( $(compgen -W "$(__docker_plugins $1)" -- "$cur") ) |
|
| 191 |
+} |
|
| 192 |
+ |
|
| 193 |
+__docker_runtimes() {
|
|
| 194 |
+ __docker_q info | sed -n 's/^Runtimes: \(.*\)/\1/p' |
|
| 195 |
+} |
|
| 196 |
+ |
|
| 197 |
+__docker_complete_runtimes() {
|
|
| 198 |
+ COMPREPLY=( $(compgen -W "$(__docker_runtimes)" -- "$cur") ) |
|
| 199 |
+} |
|
| 200 |
+ |
|
| 201 |
+# Returns a list of all nodes. Additional arguments to `docker node` |
|
| 202 |
+# may be specified in order to filter the node list, e.g. |
|
| 203 |
+# `__docker_nodes --filter role=manager` |
|
| 204 |
+# By default, only node names are completed. |
|
| 205 |
+# Set DOCKER_COMPLETION_SHOW_NODE_IDS=yes to also complete node IDs. |
|
| 206 |
+# An optional first argument `--id|--name` may be used to limit |
|
| 207 |
+# the output to the IDs or names of matching nodes. This setting takes |
|
| 208 |
+# precedence over the environment setting. |
|
| 209 |
+__docker_nodes() {
|
|
| 210 |
+ local fields='$2' # default: node name only |
|
| 211 |
+ [ "${DOCKER_COMPLETION_SHOW_NODE_IDS}" = yes ] && fields='$1,$2' # ID and name
|
|
| 212 |
+ |
|
| 213 |
+ if [ "$1" = "--id" ] ; then |
|
| 214 |
+ fields='$1' # IDs only |
|
| 215 |
+ shift |
|
| 216 |
+ elif [ "$1" = "--name" ] ; then |
|
| 217 |
+ fields='$2' # names only |
|
| 218 |
+ shift |
|
| 219 |
+ fi |
|
| 220 |
+ __docker_q node ls "$@" | tr -d '*' | awk "NR>1 {print $fields}"
|
|
| 221 |
+} |
|
| 222 |
+ |
|
| 223 |
+# Applies completion of nodes based on the current value of `$cur` or |
|
| 224 |
+# the value of the optional first argument `--cur`, if given. |
|
| 225 |
+# Additional filters may be appended, see `__docker_nodes`. |
|
| 226 |
+__docker_complete_nodes() {
|
|
| 227 |
+ local current=$cur |
|
| 228 |
+ if [ "$1" = "--cur" ] ; then |
|
| 229 |
+ current="$2" |
|
| 230 |
+ shift 2 |
|
| 231 |
+ fi |
|
| 232 |
+ COMPREPLY=( $(compgen -W "$(__docker_nodes "$@")" -- "$current") ) |
|
| 233 |
+} |
|
| 234 |
+ |
|
| 235 |
+__docker_complete_nodes_plus_self() {
|
|
| 236 |
+ __docker_complete_nodes "$@" |
|
| 237 |
+ COMPREPLY+=( self ) |
|
| 238 |
+} |
|
| 239 |
+ |
|
| 240 |
+# Returns a list of all services. Additional arguments to `docker service ls` |
|
| 241 |
+# may be specified in order to filter the service list, e.g. |
|
| 242 |
+# `__docker_services --filter name=xxx` |
|
| 243 |
+# By default, only node names are completed. |
|
| 244 |
+# Set DOCKER_COMPLETION_SHOW_SERVICE_IDS=yes to also complete service IDs. |
|
| 245 |
+# An optional first argument `--id|--name` may be used to limit |
|
| 246 |
+# the output to the IDs or names of matching services. This setting takes |
|
| 247 |
+# precedence over the environment setting. |
|
| 248 |
+__docker_services() {
|
|
| 249 |
+ local fields='$2' # default: service name only |
|
| 250 |
+ [ "${DOCKER_COMPLETION_SHOW_SERVICE_IDS}" = yes ] && fields='$1,$2' # ID & name
|
|
| 251 |
+ |
|
| 252 |
+ if [ "$1" = "--id" ] ; then |
|
| 253 |
+ fields='$1' # IDs only |
|
| 254 |
+ shift |
|
| 255 |
+ elif [ "$1" = "--name" ] ; then |
|
| 256 |
+ fields='$2' # names only |
|
| 257 |
+ shift |
|
| 258 |
+ fi |
|
| 259 |
+ __docker_q service ls "$@" | awk "NR>1 {print $fields}"
|
|
| 260 |
+} |
|
| 261 |
+ |
|
| 262 |
+# Applies completion of services based on the current value of `$cur` or |
|
| 263 |
+# the value of the optional first argument `--cur`, if given. |
|
| 264 |
+# Additional filters may be appended, see `__docker_services`. |
|
| 265 |
+__docker_complete_services() {
|
|
| 266 |
+ local current=$cur |
|
| 267 |
+ if [ "$1" = "--cur" ] ; then |
|
| 268 |
+ current="$2" |
|
| 269 |
+ shift 2 |
|
| 270 |
+ fi |
|
| 271 |
+ COMPREPLY=( $(compgen -W "$(__docker_services "$@")" -- "$current") ) |
|
| 272 |
+} |
|
| 273 |
+ |
|
| 274 |
+# Appends the word passed as an argument to every word in `$COMPREPLY`. |
|
| 275 |
+# Normally you do this with `compgen -S`. This function exists so that you can use |
|
| 276 |
+# the __docker_complete_XXX functions in cases where you need a suffix. |
|
| 277 |
+__docker_append_to_completions() {
|
|
| 278 |
+ COMPREPLY=( ${COMPREPLY[@]/%/"$1"} )
|
|
| 279 |
+} |
|
| 280 |
+ |
|
| 281 |
+# Finds the position of the first word that is neither option nor an option's argument. |
|
| 282 |
+# If there are options that require arguments, you should pass a glob describing those |
|
| 283 |
+# options, e.g. "--option1|-o|--option2" |
|
| 284 |
+# Use this function to restrict completions to exact positions after the argument list. |
|
| 285 |
+__docker_pos_first_nonflag() {
|
|
| 286 |
+ local argument_flags=$1 |
|
| 287 |
+ |
|
| 288 |
+ local counter=$((${subcommand_pos:-${command_pos}} + 1))
|
|
| 289 |
+ while [ $counter -le $cword ]; do |
|
| 290 |
+ if [ -n "$argument_flags" ] && eval "case '${words[$counter]}' in $argument_flags) true ;; *) false ;; esac"; then
|
|
| 291 |
+ (( counter++ )) |
|
| 292 |
+ # eat "=" in case of --option=arg syntax |
|
| 293 |
+ [ "${words[$counter]}" = "=" ] && (( counter++ ))
|
|
| 294 |
+ else |
|
| 295 |
+ case "${words[$counter]}" in
|
|
| 296 |
+ -*) |
|
| 297 |
+ ;; |
|
| 298 |
+ *) |
|
| 299 |
+ break |
|
| 300 |
+ ;; |
|
| 301 |
+ esac |
|
| 302 |
+ fi |
|
| 303 |
+ |
|
| 304 |
+ # Bash splits words at "=", retaining "=" as a word, examples: |
|
| 305 |
+ # "--debug=false" => 3 words, "--log-opt syslog-facility=daemon" => 4 words |
|
| 306 |
+ while [ "${words[$counter + 1]}" = "=" ] ; do
|
|
| 307 |
+ counter=$(( counter + 2)) |
|
| 308 |
+ done |
|
| 309 |
+ |
|
| 310 |
+ (( counter++ )) |
|
| 311 |
+ done |
|
| 312 |
+ |
|
| 313 |
+ echo $counter |
|
| 314 |
+} |
|
| 315 |
+ |
|
| 316 |
+# If we are currently completing the value of a map option (key=value) |
|
| 317 |
+# which matches the extglob given as an argument, returns key. |
|
| 318 |
+# This function is needed for key-specific completions. |
|
| 319 |
+__docker_map_key_of_current_option() {
|
|
| 320 |
+ local glob="$1" |
|
| 321 |
+ |
|
| 322 |
+ local key glob_pos |
|
| 323 |
+ if [ "$cur" = "=" ] ; then # key= case |
|
| 324 |
+ key="$prev" |
|
| 325 |
+ glob_pos=$((cword - 2)) |
|
| 326 |
+ elif [[ $cur == *=* ]] ; then # key=value case (OSX) |
|
| 327 |
+ key=${cur%=*}
|
|
| 328 |
+ glob_pos=$((cword - 1)) |
|
| 329 |
+ elif [ "$prev" = "=" ] ; then |
|
| 330 |
+ key=${words[$cword - 2]} # key=value case
|
|
| 331 |
+ glob_pos=$((cword - 3)) |
|
| 332 |
+ else |
|
| 333 |
+ return |
|
| 334 |
+ fi |
|
| 335 |
+ |
|
| 336 |
+ [ "${words[$glob_pos]}" = "=" ] && ((glob_pos--)) # --option=key=value syntax
|
|
| 337 |
+ |
|
| 338 |
+ [[ ${words[$glob_pos]} == @($glob) ]] && echo "$key"
|
|
| 339 |
+} |
|
| 340 |
+ |
|
| 341 |
+# Returns the value of the first option matching option_glob. |
|
| 342 |
+# Valid values for option_glob are option names like '--log-level' and |
|
| 343 |
+# globs like '--log-level|-l' |
|
| 344 |
+# Only positions between the command and the current word are considered. |
|
| 345 |
+__docker_value_of_option() {
|
|
| 346 |
+ local option_extglob=$(__docker_to_extglob "$1") |
|
| 347 |
+ |
|
| 348 |
+ local counter=$((command_pos + 1)) |
|
| 349 |
+ while [ $counter -lt $cword ]; do |
|
| 350 |
+ case ${words[$counter]} in
|
|
| 351 |
+ $option_extglob ) |
|
| 352 |
+ echo ${words[$counter + 1]}
|
|
| 353 |
+ break |
|
| 354 |
+ ;; |
|
| 355 |
+ esac |
|
| 356 |
+ (( counter++ )) |
|
| 357 |
+ done |
|
| 358 |
+} |
|
| 359 |
+ |
|
| 360 |
+# Transforms a multiline list of strings into a single line string |
|
| 361 |
+# with the words separated by "|". |
|
| 362 |
+# This is used to prepare arguments to __docker_pos_first_nonflag(). |
|
| 363 |
+__docker_to_alternatives() {
|
|
| 364 |
+ local parts=( $1 ) |
|
| 365 |
+ local IFS='|' |
|
| 366 |
+ echo "${parts[*]}"
|
|
| 367 |
+} |
|
| 368 |
+ |
|
| 369 |
+# Transforms a multiline list of options into an extglob pattern |
|
| 370 |
+# suitable for use in case statements. |
|
| 371 |
+__docker_to_extglob() {
|
|
| 372 |
+ local extglob=$( __docker_to_alternatives "$1" ) |
|
| 373 |
+ echo "@($extglob)" |
|
| 374 |
+} |
|
| 375 |
+ |
|
| 376 |
+# Subcommand processing. |
|
| 377 |
+# Locates the first occurrence of any of the subcommands contained in the |
|
| 378 |
+# first argument. In case of a match, calls the corresponding completion |
|
| 379 |
+# function and returns 0. |
|
| 380 |
+# If no match is found, 1 is returned. The calling function can then |
|
| 381 |
+# continue processing its completion. |
|
| 382 |
+# |
|
| 383 |
+# TODO if the preceding command has options that accept arguments and an |
|
| 384 |
+# argument is equal ot one of the subcommands, this is falsely detected as |
|
| 385 |
+# a match. |
|
| 386 |
+__docker_subcommands() {
|
|
| 387 |
+ local subcommands="$1" |
|
| 388 |
+ |
|
| 389 |
+ local counter=$(($command_pos + 1)) |
|
| 390 |
+ while [ $counter -lt $cword ]; do |
|
| 391 |
+ case "${words[$counter]}" in
|
|
| 392 |
+ $(__docker_to_extglob "$subcommands") ) |
|
| 393 |
+ subcommand_pos=$counter |
|
| 394 |
+ local subcommand=${words[$counter]}
|
|
| 395 |
+ local completions_func=_docker_${command}_${subcommand}
|
|
| 396 |
+ declare -F $completions_func >/dev/null && $completions_func |
|
| 397 |
+ return 0 |
|
| 398 |
+ ;; |
|
| 399 |
+ esac |
|
| 400 |
+ (( counter++ )) |
|
| 401 |
+ done |
|
| 402 |
+ return 1 |
|
| 403 |
+} |
|
| 404 |
+ |
|
| 405 |
+# suppress trailing whitespace |
|
| 406 |
+__docker_nospace() {
|
|
| 407 |
+ # compopt is not available in ancient bash versions |
|
| 408 |
+ type compopt &>/dev/null && compopt -o nospace |
|
| 409 |
+} |
|
| 410 |
+ |
|
| 411 |
+__docker_complete_resolved_hostname() {
|
|
| 412 |
+ command -v host >/dev/null 2>&1 || return |
|
| 413 |
+ COMPREPLY=( $(host 2>/dev/null "${cur%:}" | awk '/has address/ {print $4}') )
|
|
| 414 |
+} |
|
| 415 |
+ |
|
| 416 |
+__docker_complete_capabilities() {
|
|
| 417 |
+ # The list of capabilities is defined in types.go, ALL was added manually. |
|
| 418 |
+ COMPREPLY=( $( compgen -W " |
|
| 419 |
+ ALL |
|
| 420 |
+ AUDIT_CONTROL |
|
| 421 |
+ AUDIT_WRITE |
|
| 422 |
+ AUDIT_READ |
|
| 423 |
+ BLOCK_SUSPEND |
|
| 424 |
+ CHOWN |
|
| 425 |
+ DAC_OVERRIDE |
|
| 426 |
+ DAC_READ_SEARCH |
|
| 427 |
+ FOWNER |
|
| 428 |
+ FSETID |
|
| 429 |
+ IPC_LOCK |
|
| 430 |
+ IPC_OWNER |
|
| 431 |
+ KILL |
|
| 432 |
+ LEASE |
|
| 433 |
+ LINUX_IMMUTABLE |
|
| 434 |
+ MAC_ADMIN |
|
| 435 |
+ MAC_OVERRIDE |
|
| 436 |
+ MKNOD |
|
| 437 |
+ NET_ADMIN |
|
| 438 |
+ NET_BIND_SERVICE |
|
| 439 |
+ NET_BROADCAST |
|
| 440 |
+ NET_RAW |
|
| 441 |
+ SETFCAP |
|
| 442 |
+ SETGID |
|
| 443 |
+ SETPCAP |
|
| 444 |
+ SETUID |
|
| 445 |
+ SYS_ADMIN |
|
| 446 |
+ SYS_BOOT |
|
| 447 |
+ SYS_CHROOT |
|
| 448 |
+ SYSLOG |
|
| 449 |
+ SYS_MODULE |
|
| 450 |
+ SYS_NICE |
|
| 451 |
+ SYS_PACCT |
|
| 452 |
+ SYS_PTRACE |
|
| 453 |
+ SYS_RAWIO |
|
| 454 |
+ SYS_RESOURCE |
|
| 455 |
+ SYS_TIME |
|
| 456 |
+ SYS_TTY_CONFIG |
|
| 457 |
+ WAKE_ALARM |
|
| 458 |
+ " -- "$cur" ) ) |
|
| 459 |
+} |
|
| 460 |
+ |
|
| 461 |
+__docker_complete_detach-keys() {
|
|
| 462 |
+ case "$prev" in |
|
| 463 |
+ --detach-keys) |
|
| 464 |
+ case "$cur" in |
|
| 465 |
+ *,) |
|
| 466 |
+ COMPREPLY=( $( compgen -W "${cur}ctrl-" -- "$cur" ) )
|
|
| 467 |
+ ;; |
|
| 468 |
+ *) |
|
| 469 |
+ COMPREPLY=( $( compgen -W "ctrl-" -- "$cur" ) ) |
|
| 470 |
+ ;; |
|
| 471 |
+ esac |
|
| 472 |
+ |
|
| 473 |
+ __docker_nospace |
|
| 474 |
+ return |
|
| 475 |
+ ;; |
|
| 476 |
+ esac |
|
| 477 |
+ return 1 |
|
| 478 |
+} |
|
| 479 |
+ |
|
| 480 |
+__docker_complete_isolation() {
|
|
| 481 |
+ COMPREPLY=( $( compgen -W "default hyperv process" -- "$cur" ) ) |
|
| 482 |
+} |
|
| 483 |
+ |
|
| 484 |
+__docker_complete_log_drivers() {
|
|
| 485 |
+ COMPREPLY=( $( compgen -W " |
|
| 486 |
+ awslogs |
|
| 487 |
+ etwlogs |
|
| 488 |
+ fluentd |
|
| 489 |
+ gcplogs |
|
| 490 |
+ gelf |
|
| 491 |
+ journald |
|
| 492 |
+ json-file |
|
| 493 |
+ none |
|
| 494 |
+ splunk |
|
| 495 |
+ syslog |
|
| 496 |
+ " -- "$cur" ) ) |
|
| 497 |
+} |
|
| 498 |
+ |
|
| 499 |
+__docker_complete_log_options() {
|
|
| 500 |
+ # see docs/reference/logging/index.md |
|
| 501 |
+ local awslogs_options="awslogs-region awslogs-group awslogs-stream" |
|
| 502 |
+ local fluentd_options="env fluentd-address fluentd-async-connect fluentd-buffer-limit fluentd-retry-wait fluentd-max-retries labels tag" |
|
| 503 |
+ local gcplogs_options="env gcp-log-cmd gcp-project labels" |
|
| 504 |
+ local gelf_options="env gelf-address gelf-compression-level gelf-compression-type labels tag" |
|
| 505 |
+ local journald_options="env labels tag" |
|
| 506 |
+ local json_file_options="env labels max-file max-size" |
|
| 507 |
+ local syslog_options="env labels syslog-address syslog-facility syslog-format syslog-tls-ca-cert syslog-tls-cert syslog-tls-key syslog-tls-skip-verify tag" |
|
| 508 |
+ local splunk_options="env labels splunk-caname splunk-capath splunk-index splunk-insecureskipverify splunk-source splunk-sourcetype splunk-token splunk-url tag" |
|
| 509 |
+ |
|
| 510 |
+ local all_options="$fluentd_options $gcplogs_options $gelf_options $journald_options $json_file_options $syslog_options $splunk_options" |
|
| 511 |
+ |
|
| 512 |
+ case $(__docker_value_of_option --log-driver) in |
|
| 513 |
+ '') |
|
| 514 |
+ COMPREPLY=( $( compgen -W "$all_options" -S = -- "$cur" ) ) |
|
| 515 |
+ ;; |
|
| 516 |
+ awslogs) |
|
| 517 |
+ COMPREPLY=( $( compgen -W "$awslogs_options" -S = -- "$cur" ) ) |
|
| 518 |
+ ;; |
|
| 519 |
+ fluentd) |
|
| 520 |
+ COMPREPLY=( $( compgen -W "$fluentd_options" -S = -- "$cur" ) ) |
|
| 521 |
+ ;; |
|
| 522 |
+ gcplogs) |
|
| 523 |
+ COMPREPLY=( $( compgen -W "$gcplogs_options" -S = -- "$cur" ) ) |
|
| 524 |
+ ;; |
|
| 525 |
+ gelf) |
|
| 526 |
+ COMPREPLY=( $( compgen -W "$gelf_options" -S = -- "$cur" ) ) |
|
| 527 |
+ ;; |
|
| 528 |
+ journald) |
|
| 529 |
+ COMPREPLY=( $( compgen -W "$journald_options" -S = -- "$cur" ) ) |
|
| 530 |
+ ;; |
|
| 531 |
+ json-file) |
|
| 532 |
+ COMPREPLY=( $( compgen -W "$json_file_options" -S = -- "$cur" ) ) |
|
| 533 |
+ ;; |
|
| 534 |
+ syslog) |
|
| 535 |
+ COMPREPLY=( $( compgen -W "$syslog_options" -S = -- "$cur" ) ) |
|
| 536 |
+ ;; |
|
| 537 |
+ splunk) |
|
| 538 |
+ COMPREPLY=( $( compgen -W "$splunk_options" -S = -- "$cur" ) ) |
|
| 539 |
+ ;; |
|
| 540 |
+ *) |
|
| 541 |
+ return |
|
| 542 |
+ ;; |
|
| 543 |
+ esac |
|
| 544 |
+ |
|
| 545 |
+ __docker_nospace |
|
| 546 |
+} |
|
| 547 |
+ |
|
| 548 |
+__docker_complete_log_driver_options() {
|
|
| 549 |
+ local key=$(__docker_map_key_of_current_option '--log-opt') |
|
| 550 |
+ case "$key" in |
|
| 551 |
+ fluentd-async-connect) |
|
| 552 |
+ COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )
|
|
| 553 |
+ return |
|
| 554 |
+ ;; |
|
| 555 |
+ gelf-address) |
|
| 556 |
+ COMPREPLY=( $( compgen -W "udp" -S "://" -- "${cur##*=}" ) )
|
|
| 557 |
+ __docker_nospace |
|
| 558 |
+ return |
|
| 559 |
+ ;; |
|
| 560 |
+ gelf-compression-level) |
|
| 561 |
+ COMPREPLY=( $( compgen -W "1 2 3 4 5 6 7 8 9" -- "${cur##*=}" ) )
|
|
| 562 |
+ return |
|
| 563 |
+ ;; |
|
| 564 |
+ gelf-compression-type) |
|
| 565 |
+ COMPREPLY=( $( compgen -W "gzip none zlib" -- "${cur##*=}" ) )
|
|
| 566 |
+ return |
|
| 567 |
+ ;; |
|
| 568 |
+ syslog-address) |
|
| 569 |
+ COMPREPLY=( $( compgen -W "tcp:// tcp+tls:// udp:// unix://" -- "${cur##*=}" ) )
|
|
| 570 |
+ __docker_nospace |
|
| 571 |
+ __ltrim_colon_completions "${cur}"
|
|
| 572 |
+ return |
|
| 573 |
+ ;; |
|
| 574 |
+ syslog-facility) |
|
| 575 |
+ COMPREPLY=( $( compgen -W " |
|
| 576 |
+ auth |
|
| 577 |
+ authpriv |
|
| 578 |
+ cron |
|
| 579 |
+ daemon |
|
| 580 |
+ ftp |
|
| 581 |
+ kern |
|
| 582 |
+ local0 |
|
| 583 |
+ local1 |
|
| 584 |
+ local2 |
|
| 585 |
+ local3 |
|
| 586 |
+ local4 |
|
| 587 |
+ local5 |
|
| 588 |
+ local6 |
|
| 589 |
+ local7 |
|
| 590 |
+ lpr |
|
| 591 |
|
|
| 592 |
+ news |
|
| 593 |
+ syslog |
|
| 594 |
+ user |
|
| 595 |
+ uucp |
|
| 596 |
+ " -- "${cur##*=}" ) )
|
|
| 597 |
+ return |
|
| 598 |
+ ;; |
|
| 599 |
+ syslog-format) |
|
| 600 |
+ COMPREPLY=( $( compgen -W "rfc3164 rfc5424 rfc5424micro" -- "${cur##*=}" ) )
|
|
| 601 |
+ return |
|
| 602 |
+ ;; |
|
| 603 |
+ syslog-tls-ca-cert|syslog-tls-cert|syslog-tls-key) |
|
| 604 |
+ _filedir |
|
| 605 |
+ return |
|
| 606 |
+ ;; |
|
| 607 |
+ syslog-tls-skip-verify) |
|
| 608 |
+ COMPREPLY=( $( compgen -W "true" -- "${cur##*=}" ) )
|
|
| 609 |
+ return |
|
| 610 |
+ ;; |
|
| 611 |
+ splunk-url) |
|
| 612 |
+ COMPREPLY=( $( compgen -W "http:// https://" -- "${cur##*=}" ) )
|
|
| 613 |
+ __docker_nospace |
|
| 614 |
+ __ltrim_colon_completions "${cur}"
|
|
| 615 |
+ return |
|
| 616 |
+ ;; |
|
| 617 |
+ splunk-insecureskipverify) |
|
| 618 |
+ COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )
|
|
| 619 |
+ return |
|
| 620 |
+ ;; |
|
| 621 |
+ esac |
|
| 622 |
+ return 1 |
|
| 623 |
+} |
|
| 624 |
+ |
|
| 625 |
+__docker_complete_log_levels() {
|
|
| 626 |
+ COMPREPLY=( $( compgen -W "debug info warn error fatal" -- "$cur" ) ) |
|
| 627 |
+} |
|
| 628 |
+ |
|
| 629 |
+__docker_complete_restart() {
|
|
| 630 |
+ case "$prev" in |
|
| 631 |
+ --restart) |
|
| 632 |
+ case "$cur" in |
|
| 633 |
+ on-failure:*) |
|
| 634 |
+ ;; |
|
| 635 |
+ *) |
|
| 636 |
+ COMPREPLY=( $( compgen -W "always no on-failure on-failure: unless-stopped" -- "$cur") ) |
|
| 637 |
+ ;; |
|
| 638 |
+ esac |
|
| 639 |
+ return |
|
| 640 |
+ ;; |
|
| 641 |
+ esac |
|
| 642 |
+ return 1 |
|
| 643 |
+} |
|
| 644 |
+ |
|
| 645 |
+# a selection of the available signals that is most likely of interest in the |
|
| 646 |
+# context of docker containers. |
|
| 647 |
+__docker_complete_signals() {
|
|
| 648 |
+ local signals=( |
|
| 649 |
+ SIGCONT |
|
| 650 |
+ SIGHUP |
|
| 651 |
+ SIGINT |
|
| 652 |
+ SIGKILL |
|
| 653 |
+ SIGQUIT |
|
| 654 |
+ SIGSTOP |
|
| 655 |
+ SIGTERM |
|
| 656 |
+ SIGUSR1 |
|
| 657 |
+ SIGUSR2 |
|
| 658 |
+ ) |
|
| 659 |
+ COMPREPLY=( $( compgen -W "${signals[*]} ${signals[*]#SIG}" -- "$( echo $cur | tr '[:lower:]' '[:upper:]')" ) )
|
|
| 660 |
+} |
|
| 661 |
+ |
|
| 662 |
+__docker_complete_user_group() {
|
|
| 663 |
+ if [[ $cur == *:* ]] ; then |
|
| 664 |
+ COMPREPLY=( $(compgen -g -- "${cur#*:}") )
|
|
| 665 |
+ else |
|
| 666 |
+ COMPREPLY=( $(compgen -u -S : -- "$cur") ) |
|
| 667 |
+ __docker_nospace |
|
| 668 |
+ fi |
|
| 669 |
+} |
|
| 670 |
+ |
|
| 671 |
+# global options that may appear after the docker command |
|
| 672 |
+_docker_docker() {
|
|
| 673 |
+ local boolean_options=" |
|
| 674 |
+ $global_boolean_options |
|
| 675 |
+ --help |
|
| 676 |
+ --version -v |
|
| 677 |
+ " |
|
| 678 |
+ |
|
| 679 |
+ case "$prev" in |
|
| 680 |
+ --config) |
|
| 681 |
+ _filedir -d |
|
| 682 |
+ return |
|
| 683 |
+ ;; |
|
| 684 |
+ --log-level|-l) |
|
| 685 |
+ __docker_complete_log_levels |
|
| 686 |
+ return |
|
| 687 |
+ ;; |
|
| 688 |
+ $(__docker_to_extglob "$global_options_with_args") ) |
|
| 689 |
+ return |
|
| 690 |
+ ;; |
|
| 691 |
+ esac |
|
| 692 |
+ |
|
| 693 |
+ case "$cur" in |
|
| 694 |
+ -*) |
|
| 695 |
+ COMPREPLY=( $( compgen -W "$boolean_options $global_options_with_args" -- "$cur" ) ) |
|
| 696 |
+ ;; |
|
| 697 |
+ *) |
|
| 698 |
+ local counter=$( __docker_pos_first_nonflag "$(__docker_to_extglob "$global_options_with_args")" ) |
|
| 699 |
+ if [ $cword -eq $counter ]; then |
|
| 700 |
+ COMPREPLY=( $( compgen -W "${commands[*]} help" -- "$cur" ) )
|
|
| 701 |
+ fi |
|
| 702 |
+ ;; |
|
| 703 |
+ esac |
|
| 704 |
+} |
|
| 705 |
+ |
|
| 706 |
+_docker_attach() {
|
|
| 707 |
+ __docker_complete_detach-keys && return |
|
| 708 |
+ |
|
| 709 |
+ case "$cur" in |
|
| 710 |
+ -*) |
|
| 711 |
+ COMPREPLY=( $( compgen -W "--detach-keys --help --no-stdin --sig-proxy=false" -- "$cur" ) ) |
|
| 712 |
+ ;; |
|
| 713 |
+ *) |
|
| 714 |
+ local counter=$(__docker_pos_first_nonflag '--detach-keys') |
|
| 715 |
+ if [ $cword -eq $counter ]; then |
|
| 716 |
+ __docker_complete_containers_running |
|
| 717 |
+ fi |
|
| 718 |
+ ;; |
|
| 719 |
+ esac |
|
| 720 |
+} |
|
| 721 |
+ |
|
| 722 |
+_docker_build() {
|
|
| 723 |
+ local options_with_args=" |
|
| 724 |
+ --build-arg |
|
| 725 |
+ --cgroup-parent |
|
| 726 |
+ --cpuset-cpus |
|
| 727 |
+ --cpuset-mems |
|
| 728 |
+ --cpu-shares -c |
|
| 729 |
+ --cpu-period |
|
| 730 |
+ --cpu-quota |
|
| 731 |
+ --file -f |
|
| 732 |
+ --isolation |
|
| 733 |
+ --label |
|
| 734 |
+ --memory -m |
|
| 735 |
+ --memory-swap |
|
| 736 |
+ --shm-size |
|
| 737 |
+ --tag -t |
|
| 738 |
+ --ulimit |
|
| 739 |
+ " |
|
| 740 |
+ |
|
| 741 |
+ local boolean_options=" |
|
| 742 |
+ --disable-content-trust=false |
|
| 743 |
+ --force-rm |
|
| 744 |
+ --help |
|
| 745 |
+ --no-cache |
|
| 746 |
+ --pull |
|
| 747 |
+ --quiet -q |
|
| 748 |
+ --rm |
|
| 749 |
+ " |
|
| 750 |
+ |
|
| 751 |
+ local all_options="$options_with_args $boolean_options" |
|
| 752 |
+ |
|
| 753 |
+ case "$prev" in |
|
| 754 |
+ --build-arg) |
|
| 755 |
+ COMPREPLY=( $( compgen -e -- "$cur" ) ) |
|
| 756 |
+ __docker_nospace |
|
| 757 |
+ return |
|
| 758 |
+ ;; |
|
| 759 |
+ --file|-f) |
|
| 760 |
+ _filedir |
|
| 761 |
+ return |
|
| 762 |
+ ;; |
|
| 763 |
+ --isolation) |
|
| 764 |
+ __docker_complete_isolation |
|
| 765 |
+ return |
|
| 766 |
+ ;; |
|
| 767 |
+ --tag|-t) |
|
| 768 |
+ __docker_complete_image_repos_and_tags |
|
| 769 |
+ return |
|
| 770 |
+ ;; |
|
| 771 |
+ $(__docker_to_extglob "$options_with_args") ) |
|
| 772 |
+ return |
|
| 773 |
+ ;; |
|
| 774 |
+ esac |
|
| 775 |
+ |
|
| 776 |
+ case "$cur" in |
|
| 777 |
+ -*) |
|
| 778 |
+ COMPREPLY=( $( compgen -W "$all_options" -- "$cur" ) ) |
|
| 779 |
+ ;; |
|
| 780 |
+ *) |
|
| 781 |
+ local counter=$( __docker_pos_first_nonflag $( __docker_to_alternatives "$options_with_args" ) ) |
|
| 782 |
+ if [ $cword -eq $counter ]; then |
|
| 783 |
+ _filedir -d |
|
| 784 |
+ fi |
|
| 785 |
+ ;; |
|
| 786 |
+ esac |
|
| 787 |
+} |
|
| 788 |
+ |
|
| 789 |
+_docker_commit() {
|
|
| 790 |
+ case "$prev" in |
|
| 791 |
+ --author|-a|--change|-c|--message|-m) |
|
| 792 |
+ return |
|
| 793 |
+ ;; |
|
| 794 |
+ esac |
|
| 795 |
+ |
|
| 796 |
+ case "$cur" in |
|
| 797 |
+ -*) |
|
| 798 |
+ COMPREPLY=( $( compgen -W "--author -a --change -c --help --message -m --pause=false -p=false" -- "$cur" ) ) |
|
| 799 |
+ ;; |
|
| 800 |
+ *) |
|
| 801 |
+ local counter=$(__docker_pos_first_nonflag '--author|-a|--change|-c|--message|-m') |
|
| 802 |
+ |
|
| 803 |
+ if [ $cword -eq $counter ]; then |
|
| 804 |
+ __docker_complete_containers_all |
|
| 805 |
+ return |
|
| 806 |
+ fi |
|
| 807 |
+ (( counter++ )) |
|
| 808 |
+ |
|
| 809 |
+ if [ $cword -eq $counter ]; then |
|
| 810 |
+ __docker_complete_image_repos_and_tags |
|
| 811 |
+ return |
|
| 812 |
+ fi |
|
| 813 |
+ ;; |
|
| 814 |
+ esac |
|
| 815 |
+} |
|
| 816 |
+ |
|
| 817 |
+_docker_cp() {
|
|
| 818 |
+ case "$cur" in |
|
| 819 |
+ -*) |
|
| 820 |
+ COMPREPLY=( $( compgen -W "--follow-link -L --help" -- "$cur" ) ) |
|
| 821 |
+ ;; |
|
| 822 |
+ *) |
|
| 823 |
+ local counter=$(__docker_pos_first_nonflag) |
|
| 824 |
+ if [ $cword -eq $counter ]; then |
|
| 825 |
+ case "$cur" in |
|
| 826 |
+ *:) |
|
| 827 |
+ return |
|
| 828 |
+ ;; |
|
| 829 |
+ *) |
|
| 830 |
+ # combined container and filename completion |
|
| 831 |
+ _filedir |
|
| 832 |
+ local files=( ${COMPREPLY[@]} )
|
|
| 833 |
+ |
|
| 834 |
+ __docker_complete_containers_all |
|
| 835 |
+ COMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) )
|
|
| 836 |
+ local containers=( ${COMPREPLY[@]} )
|
|
| 837 |
+ |
|
| 838 |
+ COMPREPLY=( $( compgen -W "${files[*]} ${containers[*]}" -- "$cur" ) )
|
|
| 839 |
+ if [[ "$COMPREPLY" == *: ]]; then |
|
| 840 |
+ __docker_nospace |
|
| 841 |
+ fi |
|
| 842 |
+ return |
|
| 843 |
+ ;; |
|
| 844 |
+ esac |
|
| 845 |
+ fi |
|
| 846 |
+ (( counter++ )) |
|
| 847 |
+ |
|
| 848 |
+ if [ $cword -eq $counter ]; then |
|
| 849 |
+ if [ -e "$prev" ]; then |
|
| 850 |
+ __docker_complete_containers_all |
|
| 851 |
+ COMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) )
|
|
| 852 |
+ __docker_nospace |
|
| 853 |
+ else |
|
| 854 |
+ _filedir |
|
| 855 |
+ fi |
|
| 856 |
+ return |
|
| 857 |
+ fi |
|
| 858 |
+ ;; |
|
| 859 |
+ esac |
|
| 860 |
+} |
|
| 861 |
+ |
|
| 862 |
+_docker_create() {
|
|
| 863 |
+ _docker_run |
|
| 864 |
+} |
|
| 865 |
+ |
|
| 866 |
+_docker_daemon() {
|
|
| 867 |
+ local boolean_options=" |
|
| 868 |
+ $global_boolean_options |
|
| 869 |
+ --disable-legacy-registry |
|
| 870 |
+ --help |
|
| 871 |
+ --icc=false |
|
| 872 |
+ --ip-forward=false |
|
| 873 |
+ --ip-masq=false |
|
| 874 |
+ --iptables=false |
|
| 875 |
+ --ipv6 |
|
| 876 |
+ --live-restore |
|
| 877 |
+ --raw-logs |
|
| 878 |
+ --selinux-enabled |
|
| 879 |
+ --userland-proxy=false |
|
| 880 |
+ " |
|
| 881 |
+ local options_with_args=" |
|
| 882 |
+ $global_options_with_args |
|
| 883 |
+ --add-runtime |
|
| 884 |
+ --api-cors-header |
|
| 885 |
+ --authorization-plugin |
|
| 886 |
+ --bip |
|
| 887 |
+ --bridge -b |
|
| 888 |
+ --cgroup-parent |
|
| 889 |
+ --cluster-advertise |
|
| 890 |
+ --cluster-store |
|
| 891 |
+ --cluster-store-opt |
|
| 892 |
+ --config-file |
|
| 893 |
+ --containerd |
|
| 894 |
+ --default-gateway |
|
| 895 |
+ --default-gateway-v6 |
|
| 896 |
+ --default-ulimit |
|
| 897 |
+ --dns |
|
| 898 |
+ --dns-search |
|
| 899 |
+ --dns-opt |
|
| 900 |
+ --exec-opt |
|
| 901 |
+ --exec-root |
|
| 902 |
+ --fixed-cidr |
|
| 903 |
+ --fixed-cidr-v6 |
|
| 904 |
+ --graph -g |
|
| 905 |
+ --group -G |
|
| 906 |
+ --insecure-registry |
|
| 907 |
+ --ip |
|
| 908 |
+ --label |
|
| 909 |
+ --log-driver |
|
| 910 |
+ --log-opt |
|
| 911 |
+ --max-concurrent-downloads |
|
| 912 |
+ --max-concurrent-uploads |
|
| 913 |
+ --mtu |
|
| 914 |
+ --oom-score-adjust |
|
| 915 |
+ --pidfile -p |
|
| 916 |
+ --registry-mirror |
|
| 917 |
+ --storage-driver -s |
|
| 918 |
+ --storage-opt |
|
| 919 |
+ --userns-remap |
|
| 920 |
+ " |
|
| 921 |
+ |
|
| 922 |
+ __docker_complete_log_driver_options && return |
|
| 923 |
+ |
|
| 924 |
+ key=$(__docker_map_key_of_current_option '--cluster-store-opt') |
|
| 925 |
+ case "$key" in |
|
| 926 |
+ kv.*file) |
|
| 927 |
+ cur=${cur##*=}
|
|
| 928 |
+ _filedir |
|
| 929 |
+ return |
|
| 930 |
+ ;; |
|
| 931 |
+ esac |
|
| 932 |
+ |
|
| 933 |
+ local key=$(__docker_map_key_of_current_option '--storage-opt') |
|
| 934 |
+ case "$key" in |
|
| 935 |
+ dm.blkdiscard|dm.override_udev_sync_check|dm.use_deferred_removal|dm.use_deferred_deletion) |
|
| 936 |
+ COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )
|
|
| 937 |
+ return |
|
| 938 |
+ ;; |
|
| 939 |
+ dm.fs) |
|
| 940 |
+ COMPREPLY=( $( compgen -W "ext4 xfs" -- "${cur##*=}" ) )
|
|
| 941 |
+ return |
|
| 942 |
+ ;; |
|
| 943 |
+ dm.thinpooldev) |
|
| 944 |
+ cur=${cur##*=}
|
|
| 945 |
+ _filedir |
|
| 946 |
+ return |
|
| 947 |
+ ;; |
|
| 948 |
+ esac |
|
| 949 |
+ |
|
| 950 |
+ case "$prev" in |
|
| 951 |
+ --authorization-plugin) |
|
| 952 |
+ __docker_complete_plugins Authorization |
|
| 953 |
+ return |
|
| 954 |
+ ;; |
|
| 955 |
+ --cluster-store) |
|
| 956 |
+ COMPREPLY=( $( compgen -W "consul etcd zk" -S "://" -- "$cur" ) ) |
|
| 957 |
+ __docker_nospace |
|
| 958 |
+ return |
|
| 959 |
+ ;; |
|
| 960 |
+ --cluster-store-opt) |
|
| 961 |
+ COMPREPLY=( $( compgen -W "discovery.heartbeat discovery.ttl kv.cacertfile kv.certfile kv.keyfile kv.path" -S = -- "$cur" ) ) |
|
| 962 |
+ __docker_nospace |
|
| 963 |
+ return |
|
| 964 |
+ ;; |
|
| 965 |
+ --exec-root|--graph|-g) |
|
| 966 |
+ _filedir -d |
|
| 967 |
+ return |
|
| 968 |
+ ;; |
|
| 969 |
+ --log-driver) |
|
| 970 |
+ __docker_complete_log_drivers |
|
| 971 |
+ return |
|
| 972 |
+ ;; |
|
| 973 |
+ --config-file|--containerd|--pidfile|-p|--tlscacert|--tlscert|--tlskey) |
|
| 974 |
+ _filedir |
|
| 975 |
+ return |
|
| 976 |
+ ;; |
|
| 977 |
+ --storage-driver|-s) |
|
| 978 |
+ COMPREPLY=( $( compgen -W "aufs btrfs devicemapper overlay overlay2 vfs zfs" -- "$(echo $cur | tr '[:upper:]' '[:lower:]')" ) ) |
|
| 979 |
+ return |
|
| 980 |
+ ;; |
|
| 981 |
+ --storage-opt) |
|
| 982 |
+ local btrfs_options="btrfs.min_space" |
|
| 983 |
+ local devicemapper_options=" |
|
| 984 |
+ dm.basesize |
|
| 985 |
+ dm.blkdiscard |
|
| 986 |
+ dm.blocksize |
|
| 987 |
+ dm.fs |
|
| 988 |
+ dm.loopdatasize |
|
| 989 |
+ dm.loopmetadatasize |
|
| 990 |
+ dm.min_free_space |
|
| 991 |
+ dm.mkfsarg |
|
| 992 |
+ dm.mountopt |
|
| 993 |
+ dm.override_udev_sync_check |
|
| 994 |
+ dm.thinpooldev |
|
| 995 |
+ dm.use_deferred_deletion |
|
| 996 |
+ dm.use_deferred_removal |
|
| 997 |
+ " |
|
| 998 |
+ local zfs_options="zfs.fsname" |
|
| 999 |
+ |
|
| 1000 |
+ case $(__docker_value_of_option '--storage-driver|-s') in |
|
| 1001 |
+ '') |
|
| 1002 |
+ COMPREPLY=( $( compgen -W "$btrfs_options $devicemapper_options $zfs_options" -S = -- "$cur" ) ) |
|
| 1003 |
+ ;; |
|
| 1004 |
+ btrfs) |
|
| 1005 |
+ COMPREPLY=( $( compgen -W "$btrfs_options" -S = -- "$cur" ) ) |
|
| 1006 |
+ ;; |
|
| 1007 |
+ devicemapper) |
|
| 1008 |
+ COMPREPLY=( $( compgen -W "$devicemapper_options" -S = -- "$cur" ) ) |
|
| 1009 |
+ ;; |
|
| 1010 |
+ zfs) |
|
| 1011 |
+ COMPREPLY=( $( compgen -W "$zfs_options" -S = -- "$cur" ) ) |
|
| 1012 |
+ ;; |
|
| 1013 |
+ *) |
|
| 1014 |
+ return |
|
| 1015 |
+ ;; |
|
| 1016 |
+ esac |
|
| 1017 |
+ __docker_nospace |
|
| 1018 |
+ return |
|
| 1019 |
+ ;; |
|
| 1020 |
+ --log-level|-l) |
|
| 1021 |
+ __docker_complete_log_levels |
|
| 1022 |
+ return |
|
| 1023 |
+ ;; |
|
| 1024 |
+ --log-opt) |
|
| 1025 |
+ __docker_complete_log_options |
|
| 1026 |
+ return |
|
| 1027 |
+ ;; |
|
| 1028 |
+ --userns-remap) |
|
| 1029 |
+ __docker_complete_user_group |
|
| 1030 |
+ return |
|
| 1031 |
+ ;; |
|
| 1032 |
+ $(__docker_to_extglob "$options_with_args") ) |
|
| 1033 |
+ return |
|
| 1034 |
+ ;; |
|
| 1035 |
+ esac |
|
| 1036 |
+ |
|
| 1037 |
+ case "$cur" in |
|
| 1038 |
+ -*) |
|
| 1039 |
+ COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) ) |
|
| 1040 |
+ ;; |
|
| 1041 |
+ esac |
|
| 1042 |
+} |
|
| 1043 |
+ |
|
| 1044 |
+_docker_diff() {
|
|
| 1045 |
+ case "$cur" in |
|
| 1046 |
+ -*) |
|
| 1047 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 1048 |
+ ;; |
|
| 1049 |
+ *) |
|
| 1050 |
+ local counter=$(__docker_pos_first_nonflag) |
|
| 1051 |
+ if [ $cword -eq $counter ]; then |
|
| 1052 |
+ __docker_complete_containers_all |
|
| 1053 |
+ fi |
|
| 1054 |
+ ;; |
|
| 1055 |
+ esac |
|
| 1056 |
+} |
|
| 1057 |
+ |
|
| 1058 |
+_docker_events() {
|
|
| 1059 |
+ local key=$(__docker_map_key_of_current_option '-f|--filter') |
|
| 1060 |
+ case "$key" in |
|
| 1061 |
+ container) |
|
| 1062 |
+ cur="${cur##*=}"
|
|
| 1063 |
+ __docker_complete_containers_all |
|
| 1064 |
+ return |
|
| 1065 |
+ ;; |
|
| 1066 |
+ daemon) |
|
| 1067 |
+ local name=$(__docker_q info | sed -n 's/^\(ID\|Name\): //p') |
|
| 1068 |
+ COMPREPLY=( $( compgen -W "$name" -- "${cur##*=}" ) )
|
|
| 1069 |
+ return |
|
| 1070 |
+ ;; |
|
| 1071 |
+ event) |
|
| 1072 |
+ COMPREPLY=( $( compgen -W " |
|
| 1073 |
+ attach |
|
| 1074 |
+ commit |
|
| 1075 |
+ connect |
|
| 1076 |
+ copy |
|
| 1077 |
+ create |
|
| 1078 |
+ delete |
|
| 1079 |
+ destroy |
|
| 1080 |
+ detach |
|
| 1081 |
+ die |
|
| 1082 |
+ disconnect |
|
| 1083 |
+ exec_create |
|
| 1084 |
+ exec_detach |
|
| 1085 |
+ exec_start |
|
| 1086 |
+ export |
|
| 1087 |
+ import |
|
| 1088 |
+ kill |
|
| 1089 |
+ load |
|
| 1090 |
+ mount |
|
| 1091 |
+ oom |
|
| 1092 |
+ pause |
|
| 1093 |
+ pull |
|
| 1094 |
+ push |
|
| 1095 |
+ reload |
|
| 1096 |
+ rename |
|
| 1097 |
+ resize |
|
| 1098 |
+ restart |
|
| 1099 |
+ save |
|
| 1100 |
+ start |
|
| 1101 |
+ stop |
|
| 1102 |
+ tag |
|
| 1103 |
+ top |
|
| 1104 |
+ unmount |
|
| 1105 |
+ unpause |
|
| 1106 |
+ untag |
|
| 1107 |
+ update |
|
| 1108 |
+ " -- "${cur##*=}" ) )
|
|
| 1109 |
+ return |
|
| 1110 |
+ ;; |
|
| 1111 |
+ image) |
|
| 1112 |
+ cur="${cur##*=}"
|
|
| 1113 |
+ __docker_complete_images |
|
| 1114 |
+ return |
|
| 1115 |
+ ;; |
|
| 1116 |
+ network) |
|
| 1117 |
+ cur="${cur##*=}"
|
|
| 1118 |
+ __docker_complete_networks |
|
| 1119 |
+ return |
|
| 1120 |
+ ;; |
|
| 1121 |
+ type) |
|
| 1122 |
+ COMPREPLY=( $( compgen -W "container daemon image network volume" -- "${cur##*=}" ) )
|
|
| 1123 |
+ return |
|
| 1124 |
+ ;; |
|
| 1125 |
+ volume) |
|
| 1126 |
+ cur="${cur##*=}"
|
|
| 1127 |
+ __docker_complete_volumes |
|
| 1128 |
+ return |
|
| 1129 |
+ ;; |
|
| 1130 |
+ esac |
|
| 1131 |
+ |
|
| 1132 |
+ case "$prev" in |
|
| 1133 |
+ --filter|-f) |
|
| 1134 |
+ COMPREPLY=( $( compgen -S = -W "container daemon event image label network type volume" -- "$cur" ) ) |
|
| 1135 |
+ __docker_nospace |
|
| 1136 |
+ return |
|
| 1137 |
+ ;; |
|
| 1138 |
+ --since|--until) |
|
| 1139 |
+ return |
|
| 1140 |
+ ;; |
|
| 1141 |
+ esac |
|
| 1142 |
+ |
|
| 1143 |
+ case "$cur" in |
|
| 1144 |
+ -*) |
|
| 1145 |
+ COMPREPLY=( $( compgen -W "--filter -f --help --since --until" -- "$cur" ) ) |
|
| 1146 |
+ ;; |
|
| 1147 |
+ esac |
|
| 1148 |
+} |
|
| 1149 |
+ |
|
| 1150 |
+_docker_exec() {
|
|
| 1151 |
+ __docker_complete_detach-keys && return |
|
| 1152 |
+ |
|
| 1153 |
+ case "$prev" in |
|
| 1154 |
+ --user|-u) |
|
| 1155 |
+ __docker_complete_user_group |
|
| 1156 |
+ return |
|
| 1157 |
+ ;; |
|
| 1158 |
+ esac |
|
| 1159 |
+ |
|
| 1160 |
+ case "$cur" in |
|
| 1161 |
+ -*) |
|
| 1162 |
+ COMPREPLY=( $( compgen -W "--detach -d --detach-keys --help --interactive -i --privileged -t --tty -u --user" -- "$cur" ) ) |
|
| 1163 |
+ ;; |
|
| 1164 |
+ *) |
|
| 1165 |
+ __docker_complete_containers_running |
|
| 1166 |
+ ;; |
|
| 1167 |
+ esac |
|
| 1168 |
+} |
|
| 1169 |
+ |
|
| 1170 |
+_docker_export() {
|
|
| 1171 |
+ case "$cur" in |
|
| 1172 |
+ -*) |
|
| 1173 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 1174 |
+ ;; |
|
| 1175 |
+ *) |
|
| 1176 |
+ local counter=$(__docker_pos_first_nonflag) |
|
| 1177 |
+ if [ $cword -eq $counter ]; then |
|
| 1178 |
+ __docker_complete_containers_all |
|
| 1179 |
+ fi |
|
| 1180 |
+ ;; |
|
| 1181 |
+ esac |
|
| 1182 |
+} |
|
| 1183 |
+ |
|
| 1184 |
+_docker_help() {
|
|
| 1185 |
+ local counter=$(__docker_pos_first_nonflag) |
|
| 1186 |
+ if [ $cword -eq $counter ]; then |
|
| 1187 |
+ COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) )
|
|
| 1188 |
+ fi |
|
| 1189 |
+} |
|
| 1190 |
+ |
|
| 1191 |
+_docker_history() {
|
|
| 1192 |
+ case "$cur" in |
|
| 1193 |
+ -*) |
|
| 1194 |
+ COMPREPLY=( $( compgen -W "--help --human=false -H=false --no-trunc --quiet -q" -- "$cur" ) ) |
|
| 1195 |
+ ;; |
|
| 1196 |
+ *) |
|
| 1197 |
+ local counter=$(__docker_pos_first_nonflag) |
|
| 1198 |
+ if [ $cword -eq $counter ]; then |
|
| 1199 |
+ __docker_complete_images |
|
| 1200 |
+ fi |
|
| 1201 |
+ ;; |
|
| 1202 |
+ esac |
|
| 1203 |
+} |
|
| 1204 |
+ |
|
| 1205 |
+_docker_images() {
|
|
| 1206 |
+ local key=$(__docker_map_key_of_current_option '--filter|-f') |
|
| 1207 |
+ case "$key" in |
|
| 1208 |
+ before) |
|
| 1209 |
+ cur="${cur##*=}"
|
|
| 1210 |
+ __docker_complete_images |
|
| 1211 |
+ return |
|
| 1212 |
+ ;; |
|
| 1213 |
+ dangling) |
|
| 1214 |
+ COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )
|
|
| 1215 |
+ return |
|
| 1216 |
+ ;; |
|
| 1217 |
+ label) |
|
| 1218 |
+ return |
|
| 1219 |
+ ;; |
|
| 1220 |
+ since) |
|
| 1221 |
+ cur="${cur##*=}"
|
|
| 1222 |
+ __docker_complete_images |
|
| 1223 |
+ return |
|
| 1224 |
+ ;; |
|
| 1225 |
+ esac |
|
| 1226 |
+ |
|
| 1227 |
+ case "$prev" in |
|
| 1228 |
+ --filter|-f) |
|
| 1229 |
+ COMPREPLY=( $( compgen -S = -W "before dangling label since" -- "$cur" ) ) |
|
| 1230 |
+ __docker_nospace |
|
| 1231 |
+ return |
|
| 1232 |
+ ;; |
|
| 1233 |
+ --format) |
|
| 1234 |
+ return |
|
| 1235 |
+ ;; |
|
| 1236 |
+ esac |
|
| 1237 |
+ |
|
| 1238 |
+ case "$cur" in |
|
| 1239 |
+ -*) |
|
| 1240 |
+ COMPREPLY=( $( compgen -W "--all -a --digests --filter -f --format --help --no-trunc --quiet -q" -- "$cur" ) ) |
|
| 1241 |
+ ;; |
|
| 1242 |
+ =) |
|
| 1243 |
+ return |
|
| 1244 |
+ ;; |
|
| 1245 |
+ *) |
|
| 1246 |
+ __docker_complete_image_repos |
|
| 1247 |
+ ;; |
|
| 1248 |
+ esac |
|
| 1249 |
+} |
|
| 1250 |
+ |
|
| 1251 |
+_docker_import() {
|
|
| 1252 |
+ case "$prev" in |
|
| 1253 |
+ --change|-c|--message|-m) |
|
| 1254 |
+ return |
|
| 1255 |
+ ;; |
|
| 1256 |
+ esac |
|
| 1257 |
+ |
|
| 1258 |
+ case "$cur" in |
|
| 1259 |
+ -*) |
|
| 1260 |
+ COMPREPLY=( $( compgen -W "--change -c --help --message -m" -- "$cur" ) ) |
|
| 1261 |
+ ;; |
|
| 1262 |
+ *) |
|
| 1263 |
+ local counter=$(__docker_pos_first_nonflag '--change|-c|--message|-m') |
|
| 1264 |
+ if [ $cword -eq $counter ]; then |
|
| 1265 |
+ return |
|
| 1266 |
+ fi |
|
| 1267 |
+ (( counter++ )) |
|
| 1268 |
+ |
|
| 1269 |
+ if [ $cword -eq $counter ]; then |
|
| 1270 |
+ __docker_complete_image_repos_and_tags |
|
| 1271 |
+ return |
|
| 1272 |
+ fi |
|
| 1273 |
+ ;; |
|
| 1274 |
+ esac |
|
| 1275 |
+} |
|
| 1276 |
+ |
|
| 1277 |
+_docker_info() {
|
|
| 1278 |
+ case "$cur" in |
|
| 1279 |
+ -*) |
|
| 1280 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 1281 |
+ ;; |
|
| 1282 |
+ esac |
|
| 1283 |
+} |
|
| 1284 |
+ |
|
| 1285 |
+_docker_inspect() {
|
|
| 1286 |
+ case "$prev" in |
|
| 1287 |
+ --format|-f) |
|
| 1288 |
+ return |
|
| 1289 |
+ ;; |
|
| 1290 |
+ --type) |
|
| 1291 |
+ COMPREPLY=( $( compgen -W "image container" -- "$cur" ) ) |
|
| 1292 |
+ return |
|
| 1293 |
+ ;; |
|
| 1294 |
+ |
|
| 1295 |
+ esac |
|
| 1296 |
+ |
|
| 1297 |
+ case "$cur" in |
|
| 1298 |
+ -*) |
|
| 1299 |
+ COMPREPLY=( $( compgen -W "--format -f --help --size -s --type" -- "$cur" ) ) |
|
| 1300 |
+ ;; |
|
| 1301 |
+ *) |
|
| 1302 |
+ case $(__docker_value_of_option --type) in |
|
| 1303 |
+ '') |
|
| 1304 |
+ __docker_complete_containers_and_images |
|
| 1305 |
+ ;; |
|
| 1306 |
+ container) |
|
| 1307 |
+ __docker_complete_containers_all |
|
| 1308 |
+ ;; |
|
| 1309 |
+ image) |
|
| 1310 |
+ __docker_complete_images |
|
| 1311 |
+ ;; |
|
| 1312 |
+ esac |
|
| 1313 |
+ esac |
|
| 1314 |
+} |
|
| 1315 |
+ |
|
| 1316 |
+_docker_kill() {
|
|
| 1317 |
+ case "$prev" in |
|
| 1318 |
+ --signal|-s) |
|
| 1319 |
+ __docker_complete_signals |
|
| 1320 |
+ return |
|
| 1321 |
+ ;; |
|
| 1322 |
+ esac |
|
| 1323 |
+ |
|
| 1324 |
+ case "$cur" in |
|
| 1325 |
+ -*) |
|
| 1326 |
+ COMPREPLY=( $( compgen -W "--help --signal -s" -- "$cur" ) ) |
|
| 1327 |
+ ;; |
|
| 1328 |
+ *) |
|
| 1329 |
+ __docker_complete_containers_running |
|
| 1330 |
+ ;; |
|
| 1331 |
+ esac |
|
| 1332 |
+} |
|
| 1333 |
+ |
|
| 1334 |
+_docker_load() {
|
|
| 1335 |
+ case "$prev" in |
|
| 1336 |
+ --input|-i) |
|
| 1337 |
+ _filedir |
|
| 1338 |
+ return |
|
| 1339 |
+ ;; |
|
| 1340 |
+ esac |
|
| 1341 |
+ |
|
| 1342 |
+ case "$cur" in |
|
| 1343 |
+ -*) |
|
| 1344 |
+ COMPREPLY=( $( compgen -W "--help --input -i --quiet -q" -- "$cur" ) ) |
|
| 1345 |
+ ;; |
|
| 1346 |
+ esac |
|
| 1347 |
+} |
|
| 1348 |
+ |
|
| 1349 |
+_docker_login() {
|
|
| 1350 |
+ case "$prev" in |
|
| 1351 |
+ --password|-p|--username|-u) |
|
| 1352 |
+ return |
|
| 1353 |
+ ;; |
|
| 1354 |
+ esac |
|
| 1355 |
+ |
|
| 1356 |
+ case "$cur" in |
|
| 1357 |
+ -*) |
|
| 1358 |
+ COMPREPLY=( $( compgen -W "--help --password -p --username -u" -- "$cur" ) ) |
|
| 1359 |
+ ;; |
|
| 1360 |
+ esac |
|
| 1361 |
+} |
|
| 1362 |
+ |
|
| 1363 |
+_docker_logout() {
|
|
| 1364 |
+ case "$cur" in |
|
| 1365 |
+ -*) |
|
| 1366 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 1367 |
+ ;; |
|
| 1368 |
+ esac |
|
| 1369 |
+} |
|
| 1370 |
+ |
|
| 1371 |
+_docker_logs() {
|
|
| 1372 |
+ case "$prev" in |
|
| 1373 |
+ --since|--tail) |
|
| 1374 |
+ return |
|
| 1375 |
+ ;; |
|
| 1376 |
+ esac |
|
| 1377 |
+ |
|
| 1378 |
+ case "$cur" in |
|
| 1379 |
+ -*) |
|
| 1380 |
+ COMPREPLY=( $( compgen -W "--details --follow -f --help --since --tail --timestamps -t" -- "$cur" ) ) |
|
| 1381 |
+ ;; |
|
| 1382 |
+ *) |
|
| 1383 |
+ local counter=$(__docker_pos_first_nonflag '--tail') |
|
| 1384 |
+ if [ $cword -eq $counter ]; then |
|
| 1385 |
+ __docker_complete_containers_all |
|
| 1386 |
+ fi |
|
| 1387 |
+ ;; |
|
| 1388 |
+ esac |
|
| 1389 |
+} |
|
| 1390 |
+ |
|
| 1391 |
+_docker_network_connect() {
|
|
| 1392 |
+ local options_with_args=" |
|
| 1393 |
+ --alias |
|
| 1394 |
+ --ip |
|
| 1395 |
+ --ip6 |
|
| 1396 |
+ --link |
|
| 1397 |
+ --link-local-ip |
|
| 1398 |
+ " |
|
| 1399 |
+ |
|
| 1400 |
+ local boolean_options=" |
|
| 1401 |
+ --help |
|
| 1402 |
+ " |
|
| 1403 |
+ |
|
| 1404 |
+ case "$prev" in |
|
| 1405 |
+ --link) |
|
| 1406 |
+ case "$cur" in |
|
| 1407 |
+ *:*) |
|
| 1408 |
+ ;; |
|
| 1409 |
+ *) |
|
| 1410 |
+ __docker_complete_containers_running |
|
| 1411 |
+ COMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) )
|
|
| 1412 |
+ __docker_nospace |
|
| 1413 |
+ ;; |
|
| 1414 |
+ esac |
|
| 1415 |
+ return |
|
| 1416 |
+ ;; |
|
| 1417 |
+ $(__docker_to_extglob "$options_with_args") ) |
|
| 1418 |
+ return |
|
| 1419 |
+ ;; |
|
| 1420 |
+ esac |
|
| 1421 |
+ |
|
| 1422 |
+ case "$cur" in |
|
| 1423 |
+ -*) |
|
| 1424 |
+ COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) ) |
|
| 1425 |
+ ;; |
|
| 1426 |
+ *) |
|
| 1427 |
+ local counter=$( __docker_pos_first_nonflag $( __docker_to_alternatives "$options_with_args" ) ) |
|
| 1428 |
+ if [ $cword -eq $counter ]; then |
|
| 1429 |
+ __docker_complete_networks |
|
| 1430 |
+ elif [ $cword -eq $(($counter + 1)) ]; then |
|
| 1431 |
+ __docker_complete_containers_all |
|
| 1432 |
+ fi |
|
| 1433 |
+ ;; |
|
| 1434 |
+ esac |
|
| 1435 |
+} |
|
| 1436 |
+ |
|
| 1437 |
+_docker_network_create() {
|
|
| 1438 |
+ case "$prev" in |
|
| 1439 |
+ --aux-address|--gateway|--internal|--ip-range|--ipam-opt|--ipv6|--opt|-o|--subnet) |
|
| 1440 |
+ return |
|
| 1441 |
+ ;; |
|
| 1442 |
+ --ipam-driver) |
|
| 1443 |
+ COMPREPLY=( $( compgen -W "default" -- "$cur" ) ) |
|
| 1444 |
+ return |
|
| 1445 |
+ ;; |
|
| 1446 |
+ --driver|-d) |
|
| 1447 |
+ local plugins="$(__docker_plugins Network) macvlan" |
|
| 1448 |
+ # remove drivers that allow one instance only |
|
| 1449 |
+ plugins=${plugins/ host / }
|
|
| 1450 |
+ plugins=${plugins/ null / }
|
|
| 1451 |
+ COMPREPLY=( $(compgen -W "$plugins" -- "$cur") ) |
|
| 1452 |
+ return |
|
| 1453 |
+ ;; |
|
| 1454 |
+ --label) |
|
| 1455 |
+ return |
|
| 1456 |
+ ;; |
|
| 1457 |
+ esac |
|
| 1458 |
+ |
|
| 1459 |
+ case "$cur" in |
|
| 1460 |
+ -*) |
|
| 1461 |
+ COMPREPLY=( $( compgen -W "--aux-address --driver -d --gateway --help --internal --ip-range --ipam-driver --ipam-opt --ipv6 --label --opt -o --subnet" -- "$cur" ) ) |
|
| 1462 |
+ ;; |
|
| 1463 |
+ esac |
|
| 1464 |
+} |
|
| 1465 |
+ |
|
| 1466 |
+_docker_network_disconnect() {
|
|
| 1467 |
+ case "$cur" in |
|
| 1468 |
+ -*) |
|
| 1469 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 1470 |
+ ;; |
|
| 1471 |
+ *) |
|
| 1472 |
+ local counter=$(__docker_pos_first_nonflag) |
|
| 1473 |
+ if [ $cword -eq $counter ]; then |
|
| 1474 |
+ __docker_complete_networks |
|
| 1475 |
+ elif [ $cword -eq $(($counter + 1)) ]; then |
|
| 1476 |
+ __docker_complete_containers_in_network "$prev" |
|
| 1477 |
+ fi |
|
| 1478 |
+ ;; |
|
| 1479 |
+ esac |
|
| 1480 |
+} |
|
| 1481 |
+ |
|
| 1482 |
+_docker_network_inspect() {
|
|
| 1483 |
+ case "$prev" in |
|
| 1484 |
+ --format|-f) |
|
| 1485 |
+ return |
|
| 1486 |
+ ;; |
|
| 1487 |
+ esac |
|
| 1488 |
+ |
|
| 1489 |
+ case "$cur" in |
|
| 1490 |
+ -*) |
|
| 1491 |
+ COMPREPLY=( $( compgen -W "--format -f --help" -- "$cur" ) ) |
|
| 1492 |
+ ;; |
|
| 1493 |
+ *) |
|
| 1494 |
+ __docker_complete_networks |
|
| 1495 |
+ esac |
|
| 1496 |
+} |
|
| 1497 |
+ |
|
| 1498 |
+_docker_network_ls() {
|
|
| 1499 |
+ local key=$(__docker_map_key_of_current_option '--filter|-f') |
|
| 1500 |
+ case "$key" in |
|
| 1501 |
+ driver) |
|
| 1502 |
+ local plugins=" $(__docker_plugins Network) " |
|
| 1503 |
+ COMPREPLY=( $(compgen -W "$plugins" -- "${cur##*=}") )
|
|
| 1504 |
+ return |
|
| 1505 |
+ ;; |
|
| 1506 |
+ id) |
|
| 1507 |
+ cur="${cur##*=}"
|
|
| 1508 |
+ __docker_complete_network_ids |
|
| 1509 |
+ return |
|
| 1510 |
+ ;; |
|
| 1511 |
+ name) |
|
| 1512 |
+ cur="${cur##*=}"
|
|
| 1513 |
+ __docker_complete_network_names |
|
| 1514 |
+ return |
|
| 1515 |
+ ;; |
|
| 1516 |
+ type) |
|
| 1517 |
+ COMPREPLY=( $( compgen -W "builtin custom" -- "${cur##*=}" ) )
|
|
| 1518 |
+ return |
|
| 1519 |
+ ;; |
|
| 1520 |
+ esac |
|
| 1521 |
+ |
|
| 1522 |
+ case "$prev" in |
|
| 1523 |
+ --filter|-f) |
|
| 1524 |
+ COMPREPLY=( $( compgen -S = -W "driver id label name type" -- "$cur" ) ) |
|
| 1525 |
+ __docker_nospace |
|
| 1526 |
+ return |
|
| 1527 |
+ ;; |
|
| 1528 |
+ esac |
|
| 1529 |
+ |
|
| 1530 |
+ case "$cur" in |
|
| 1531 |
+ -*) |
|
| 1532 |
+ COMPREPLY=( $( compgen -W "--filter -f --help --no-trunc --quiet -q" -- "$cur" ) ) |
|
| 1533 |
+ ;; |
|
| 1534 |
+ esac |
|
| 1535 |
+} |
|
| 1536 |
+ |
|
| 1537 |
+_docker_network_rm() {
|
|
| 1538 |
+ case "$cur" in |
|
| 1539 |
+ -*) |
|
| 1540 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 1541 |
+ ;; |
|
| 1542 |
+ *) |
|
| 1543 |
+ __docker_complete_networks type=custom |
|
| 1544 |
+ esac |
|
| 1545 |
+} |
|
| 1546 |
+ |
|
| 1547 |
+_docker_network() {
|
|
| 1548 |
+ local subcommands=" |
|
| 1549 |
+ connect |
|
| 1550 |
+ create |
|
| 1551 |
+ disconnect |
|
| 1552 |
+ inspect |
|
| 1553 |
+ ls |
|
| 1554 |
+ rm |
|
| 1555 |
+ " |
|
| 1556 |
+ __docker_subcommands "$subcommands" && return |
|
| 1557 |
+ |
|
| 1558 |
+ case "$cur" in |
|
| 1559 |
+ -*) |
|
| 1560 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 1561 |
+ ;; |
|
| 1562 |
+ *) |
|
| 1563 |
+ COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) |
|
| 1564 |
+ ;; |
|
| 1565 |
+ esac |
|
| 1566 |
+} |
|
| 1567 |
+ |
|
| 1568 |
+_docker_service() {
|
|
| 1569 |
+ local subcommands=" |
|
| 1570 |
+ create |
|
| 1571 |
+ inspect |
|
| 1572 |
+ ls list |
|
| 1573 |
+ rm remove |
|
| 1574 |
+ scale |
|
| 1575 |
+ ps |
|
| 1576 |
+ update |
|
| 1577 |
+ " |
|
| 1578 |
+ __docker_subcommands "$subcommands" && return |
|
| 1579 |
+ |
|
| 1580 |
+ case "$cur" in |
|
| 1581 |
+ -*) |
|
| 1582 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 1583 |
+ ;; |
|
| 1584 |
+ *) |
|
| 1585 |
+ COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) |
|
| 1586 |
+ ;; |
|
| 1587 |
+ esac |
|
| 1588 |
+} |
|
| 1589 |
+ |
|
| 1590 |
+_docker_service_create() {
|
|
| 1591 |
+ _docker_service_update |
|
| 1592 |
+} |
|
| 1593 |
+ |
|
| 1594 |
+_docker_service_inspect() {
|
|
| 1595 |
+ case "$prev" in |
|
| 1596 |
+ --format|-f) |
|
| 1597 |
+ return |
|
| 1598 |
+ ;; |
|
| 1599 |
+ esac |
|
| 1600 |
+ |
|
| 1601 |
+ case "$cur" in |
|
| 1602 |
+ -*) |
|
| 1603 |
+ COMPREPLY=( $( compgen -W "--format -f --help --pretty" -- "$cur" ) ) |
|
| 1604 |
+ ;; |
|
| 1605 |
+ *) |
|
| 1606 |
+ __docker_complete_services |
|
| 1607 |
+ esac |
|
| 1608 |
+} |
|
| 1609 |
+ |
|
| 1610 |
+_docker_service_list() {
|
|
| 1611 |
+ _docker_service_ls |
|
| 1612 |
+} |
|
| 1613 |
+ |
|
| 1614 |
+_docker_service_ls() {
|
|
| 1615 |
+ local key=$(__docker_map_key_of_current_option '--filter|-f') |
|
| 1616 |
+ case "$key" in |
|
| 1617 |
+ id) |
|
| 1618 |
+ __docker_complete_services --cur "${cur##*=}" --id
|
|
| 1619 |
+ return |
|
| 1620 |
+ ;; |
|
| 1621 |
+ name) |
|
| 1622 |
+ __docker_complete_services --cur "${cur##*=}" --name
|
|
| 1623 |
+ return |
|
| 1624 |
+ ;; |
|
| 1625 |
+ esac |
|
| 1626 |
+ |
|
| 1627 |
+ case "$prev" in |
|
| 1628 |
+ --filter|-f) |
|
| 1629 |
+ COMPREPLY=( $( compgen -W "id label name" -S = -- "$cur" ) ) |
|
| 1630 |
+ __docker_nospace |
|
| 1631 |
+ return |
|
| 1632 |
+ ;; |
|
| 1633 |
+ esac |
|
| 1634 |
+ |
|
| 1635 |
+ case "$cur" in |
|
| 1636 |
+ -*) |
|
| 1637 |
+ COMPREPLY=( $( compgen -W "--filter -f --help --quiet -q" -- "$cur" ) ) |
|
| 1638 |
+ ;; |
|
| 1639 |
+ esac |
|
| 1640 |
+} |
|
| 1641 |
+ |
|
| 1642 |
+_docker_service_remove() {
|
|
| 1643 |
+ _docker_service_rm |
|
| 1644 |
+} |
|
| 1645 |
+ |
|
| 1646 |
+_docker_service_rm() {
|
|
| 1647 |
+ case "$cur" in |
|
| 1648 |
+ -*) |
|
| 1649 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 1650 |
+ ;; |
|
| 1651 |
+ *) |
|
| 1652 |
+ __docker_complete_services |
|
| 1653 |
+ esac |
|
| 1654 |
+} |
|
| 1655 |
+ |
|
| 1656 |
+_docker_service_scale() {
|
|
| 1657 |
+ case "$cur" in |
|
| 1658 |
+ -*) |
|
| 1659 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 1660 |
+ ;; |
|
| 1661 |
+ *) |
|
| 1662 |
+ __docker_complete_services |
|
| 1663 |
+ __docker_append_to_completions "=" |
|
| 1664 |
+ __docker_nospace |
|
| 1665 |
+ ;; |
|
| 1666 |
+ esac |
|
| 1667 |
+} |
|
| 1668 |
+ |
|
| 1669 |
+_docker_service_ps() {
|
|
| 1670 |
+ local key=$(__docker_map_key_of_current_option '--filter|-f') |
|
| 1671 |
+ case "$key" in |
|
| 1672 |
+ desired-state) |
|
| 1673 |
+ COMPREPLY=( $( compgen -W "accepted running" -- "${cur##*=}" ) )
|
|
| 1674 |
+ return |
|
| 1675 |
+ ;; |
|
| 1676 |
+ name) |
|
| 1677 |
+ __docker_complete_services --cur "${cur##*=}" --name
|
|
| 1678 |
+ return |
|
| 1679 |
+ ;; |
|
| 1680 |
+ esac |
|
| 1681 |
+ |
|
| 1682 |
+ case "$prev" in |
|
| 1683 |
+ --filter|-f) |
|
| 1684 |
+ COMPREPLY=( $( compgen -W "desired-state id name" -S = -- "$cur" ) ) |
|
| 1685 |
+ __docker_nospace |
|
| 1686 |
+ return |
|
| 1687 |
+ ;; |
|
| 1688 |
+ esac |
|
| 1689 |
+ |
|
| 1690 |
+ case "$cur" in |
|
| 1691 |
+ -*) |
|
| 1692 |
+ COMPREPLY=( $( compgen -W "--all -a --filter -f --help --no-resolve" -- "$cur" ) ) |
|
| 1693 |
+ ;; |
|
| 1694 |
+ *) |
|
| 1695 |
+ local counter=$(__docker_pos_first_nonflag '--filter|-f') |
|
| 1696 |
+ if [ $cword -eq $counter ]; then |
|
| 1697 |
+ __docker_complete_services |
|
| 1698 |
+ fi |
|
| 1699 |
+ ;; |
|
| 1700 |
+ esac |
|
| 1701 |
+} |
|
| 1702 |
+ |
|
| 1703 |
+_docker_service_update() {
|
|
| 1704 |
+ local $subcommand="${words[$subcommand_pos]}"
|
|
| 1705 |
+ |
|
| 1706 |
+ local options_with_args=" |
|
| 1707 |
+ --constraint |
|
| 1708 |
+ --endpoint-mode |
|
| 1709 |
+ --env -e |
|
| 1710 |
+ --label -l |
|
| 1711 |
+ --limit-cpu |
|
| 1712 |
+ --limit-memory |
|
| 1713 |
+ --log-driver |
|
| 1714 |
+ --log-opt |
|
| 1715 |
+ --mount |
|
| 1716 |
+ --name |
|
| 1717 |
+ --network |
|
| 1718 |
+ --publish -p |
|
| 1719 |
+ --replicas |
|
| 1720 |
+ --reserve-cpu |
|
| 1721 |
+ --reserve-memory |
|
| 1722 |
+ --restart-condition |
|
| 1723 |
+ --restart-delay |
|
| 1724 |
+ --restart-max-attempts |
|
| 1725 |
+ --restart-window |
|
| 1726 |
+ --stop-grace-period |
|
| 1727 |
+ --update-delay |
|
| 1728 |
+ --update-failure-action |
|
| 1729 |
+ --update-parallelism |
|
| 1730 |
+ --user -u |
|
| 1731 |
+ --workdir -w |
|
| 1732 |
+ " |
|
| 1733 |
+ |
|
| 1734 |
+ local boolean_options=" |
|
| 1735 |
+ --help |
|
| 1736 |
+ --with-registry-auth |
|
| 1737 |
+ " |
|
| 1738 |
+ |
|
| 1739 |
+ __docker_complete_log_driver_options && return |
|
| 1740 |
+ |
|
| 1741 |
+ if [ "$subcommand" = "create" ] ; then |
|
| 1742 |
+ options_with_args="$options_with_args |
|
| 1743 |
+ --container-label |
|
| 1744 |
+ --mode |
|
| 1745 |
+ " |
|
| 1746 |
+ |
|
| 1747 |
+ case "$prev" in |
|
| 1748 |
+ --mode) |
|
| 1749 |
+ COMPREPLY=( $( compgen -W "global replicated" -- "$cur" ) ) |
|
| 1750 |
+ return |
|
| 1751 |
+ ;; |
|
| 1752 |
+ esac |
|
| 1753 |
+ fi |
|
| 1754 |
+ if [ "$subcommand" = "update" ] ; then |
|
| 1755 |
+ options_with_args="$options_with_args |
|
| 1756 |
+ --arg |
|
| 1757 |
+ --container-label-add |
|
| 1758 |
+ --container-label-rm |
|
| 1759 |
+ --image |
|
| 1760 |
+ " |
|
| 1761 |
+ |
|
| 1762 |
+ case "$prev" in |
|
| 1763 |
+ --image) |
|
| 1764 |
+ __docker_complete_image_repos_and_tags |
|
| 1765 |
+ return |
|
| 1766 |
+ ;; |
|
| 1767 |
+ esac |
|
| 1768 |
+ fi |
|
| 1769 |
+ |
|
| 1770 |
+ case "$prev" in |
|
| 1771 |
+ --endpoint-mode) |
|
| 1772 |
+ COMPREPLY=( $( compgen -W "dnsrr vip" -- "$cur" ) ) |
|
| 1773 |
+ return |
|
| 1774 |
+ ;; |
|
| 1775 |
+ --env|-e) |
|
| 1776 |
+ COMPREPLY=( $( compgen -e -S = -- "$cur" ) ) |
|
| 1777 |
+ __docker_nospace |
|
| 1778 |
+ return |
|
| 1779 |
+ ;; |
|
| 1780 |
+ --log-driver) |
|
| 1781 |
+ __docker_complete_log_drivers |
|
| 1782 |
+ return |
|
| 1783 |
+ ;; |
|
| 1784 |
+ --log-opt) |
|
| 1785 |
+ __docker_complete_log_options |
|
| 1786 |
+ return |
|
| 1787 |
+ ;; |
|
| 1788 |
+ --network) |
|
| 1789 |
+ __docker_complete_networks |
|
| 1790 |
+ return |
|
| 1791 |
+ ;; |
|
| 1792 |
+ --restart-condition) |
|
| 1793 |
+ COMPREPLY=( $( compgen -W "any none on-failure" -- "$cur" ) ) |
|
| 1794 |
+ return |
|
| 1795 |
+ ;; |
|
| 1796 |
+ --user|-u) |
|
| 1797 |
+ __docker_complete_user_group |
|
| 1798 |
+ return |
|
| 1799 |
+ ;; |
|
| 1800 |
+ $(__docker_to_extglob "$options_with_args") ) |
|
| 1801 |
+ return |
|
| 1802 |
+ ;; |
|
| 1803 |
+ esac |
|
| 1804 |
+ |
|
| 1805 |
+ case "$cur" in |
|
| 1806 |
+ -*) |
|
| 1807 |
+ COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) ) |
|
| 1808 |
+ ;; |
|
| 1809 |
+ *) |
|
| 1810 |
+ if [ "$subcommand" = "update" ] ; then |
|
| 1811 |
+ __docker_complete_services |
|
| 1812 |
+ fi |
|
| 1813 |
+ esac |
|
| 1814 |
+} |
|
| 1815 |
+ |
|
| 1816 |
+_docker_swarm() {
|
|
| 1817 |
+ local subcommands=" |
|
| 1818 |
+ init |
|
| 1819 |
+ join |
|
| 1820 |
+ join-token |
|
| 1821 |
+ leave |
|
| 1822 |
+ update |
|
| 1823 |
+ " |
|
| 1824 |
+ __docker_subcommands "$subcommands" && return |
|
| 1825 |
+ |
|
| 1826 |
+ case "$cur" in |
|
| 1827 |
+ -*) |
|
| 1828 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 1829 |
+ ;; |
|
| 1830 |
+ *) |
|
| 1831 |
+ COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) |
|
| 1832 |
+ ;; |
|
| 1833 |
+ esac |
|
| 1834 |
+} |
|
| 1835 |
+ |
|
| 1836 |
+_docker_swarm_init() {
|
|
| 1837 |
+ case "$prev" in |
|
| 1838 |
+ --listen-addr) |
|
| 1839 |
+ if [[ $cur == *: ]] ; then |
|
| 1840 |
+ COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) )
|
|
| 1841 |
+ fi |
|
| 1842 |
+ return |
|
| 1843 |
+ ;; |
|
| 1844 |
+ --advertise-addr) |
|
| 1845 |
+ if [[ $cur == *: ]] ; then |
|
| 1846 |
+ COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) )
|
|
| 1847 |
+ fi |
|
| 1848 |
+ return |
|
| 1849 |
+ ;; |
|
| 1850 |
+ esac |
|
| 1851 |
+ |
|
| 1852 |
+ case "$cur" in |
|
| 1853 |
+ -*) |
|
| 1854 |
+ COMPREPLY=( $( compgen -W "--advertise-addr --force-new-cluster --help --listen-addr" -- "$cur" ) ) |
|
| 1855 |
+ ;; |
|
| 1856 |
+ esac |
|
| 1857 |
+} |
|
| 1858 |
+ |
|
| 1859 |
+_docker_swarm_join() {
|
|
| 1860 |
+ case "$prev" in |
|
| 1861 |
+ --token) |
|
| 1862 |
+ return |
|
| 1863 |
+ ;; |
|
| 1864 |
+ --listen-addr) |
|
| 1865 |
+ if [[ $cur == *: ]] ; then |
|
| 1866 |
+ COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) )
|
|
| 1867 |
+ fi |
|
| 1868 |
+ return |
|
| 1869 |
+ ;; |
|
| 1870 |
+ --advertise-addr) |
|
| 1871 |
+ if [[ $cur == *: ]] ; then |
|
| 1872 |
+ COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) )
|
|
| 1873 |
+ fi |
|
| 1874 |
+ return |
|
| 1875 |
+ ;; |
|
| 1876 |
+ esac |
|
| 1877 |
+ |
|
| 1878 |
+ case "$cur" in |
|
| 1879 |
+ -*) |
|
| 1880 |
+ COMPREPLY=( $( compgen -W "--adveritse-addr --help --listen-addr --token" -- "$cur" ) ) |
|
| 1881 |
+ ;; |
|
| 1882 |
+ *:) |
|
| 1883 |
+ COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) )
|
|
| 1884 |
+ ;; |
|
| 1885 |
+ esac |
|
| 1886 |
+} |
|
| 1887 |
+ |
|
| 1888 |
+_docker_swarm_join-token() {
|
|
| 1889 |
+ case "$cur" in |
|
| 1890 |
+ -*) |
|
| 1891 |
+ COMPREPLY=( $( compgen -W "--help --quiet -q --rotate" -- "$cur" ) ) |
|
| 1892 |
+ ;; |
|
| 1893 |
+ *) |
|
| 1894 |
+ local counter=$( __docker_pos_first_nonflag ) |
|
| 1895 |
+ if [ $cword -eq $counter ]; then |
|
| 1896 |
+ COMPREPLY=( $( compgen -W "manager worker" -- "$cur" ) ) |
|
| 1897 |
+ fi |
|
| 1898 |
+ ;; |
|
| 1899 |
+ esac |
|
| 1900 |
+} |
|
| 1901 |
+ |
|
| 1902 |
+_docker_swarm_leave() {
|
|
| 1903 |
+ case "$cur" in |
|
| 1904 |
+ -*) |
|
| 1905 |
+ COMPREPLY=( $( compgen -W "--force --help" -- "$cur" ) ) |
|
| 1906 |
+ ;; |
|
| 1907 |
+ esac |
|
| 1908 |
+} |
|
| 1909 |
+ |
|
| 1910 |
+_docker_swarm_update() {
|
|
| 1911 |
+ case "$prev" in |
|
| 1912 |
+ --cert-expiry|--dispatcher-heartbeat|--task-history-limit) |
|
| 1913 |
+ return |
|
| 1914 |
+ ;; |
|
| 1915 |
+ esac |
|
| 1916 |
+ |
|
| 1917 |
+ case "$cur" in |
|
| 1918 |
+ -*) |
|
| 1919 |
+ COMPREPLY=( $( compgen -W "--cert-expiry --dispatcher-heartbeat --help --task-history-limit" -- "$cur" ) ) |
|
| 1920 |
+ ;; |
|
| 1921 |
+ esac |
|
| 1922 |
+} |
|
| 1923 |
+ |
|
| 1924 |
+_docker_node() {
|
|
| 1925 |
+ local subcommands=" |
|
| 1926 |
+ demote |
|
| 1927 |
+ inspect |
|
| 1928 |
+ ls list |
|
| 1929 |
+ promote |
|
| 1930 |
+ rm remove |
|
| 1931 |
+ ps |
|
| 1932 |
+ update |
|
| 1933 |
+ " |
|
| 1934 |
+ __docker_subcommands "$subcommands" && return |
|
| 1935 |
+ |
|
| 1936 |
+ case "$cur" in |
|
| 1937 |
+ -*) |
|
| 1938 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 1939 |
+ ;; |
|
| 1940 |
+ *) |
|
| 1941 |
+ COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) |
|
| 1942 |
+ ;; |
|
| 1943 |
+ esac |
|
| 1944 |
+} |
|
| 1945 |
+ |
|
| 1946 |
+_docker_node_demote() {
|
|
| 1947 |
+ case "$cur" in |
|
| 1948 |
+ -*) |
|
| 1949 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 1950 |
+ ;; |
|
| 1951 |
+ *) |
|
| 1952 |
+ __docker_complete_nodes --filter role=manager |
|
| 1953 |
+ esac |
|
| 1954 |
+} |
|
| 1955 |
+ |
|
| 1956 |
+_docker_node_inspect() {
|
|
| 1957 |
+ case "$prev" in |
|
| 1958 |
+ --format|-f) |
|
| 1959 |
+ return |
|
| 1960 |
+ ;; |
|
| 1961 |
+ esac |
|
| 1962 |
+ |
|
| 1963 |
+ case "$cur" in |
|
| 1964 |
+ -*) |
|
| 1965 |
+ COMPREPLY=( $( compgen -W "--format -f --help --pretty" -- "$cur" ) ) |
|
| 1966 |
+ ;; |
|
| 1967 |
+ *) |
|
| 1968 |
+ __docker_complete_nodes |
|
| 1969 |
+ esac |
|
| 1970 |
+} |
|
| 1971 |
+ |
|
| 1972 |
+_docker_node_list() {
|
|
| 1973 |
+ _docker_node_ls |
|
| 1974 |
+} |
|
| 1975 |
+ |
|
| 1976 |
+_docker_node_ls() {
|
|
| 1977 |
+ local key=$(__docker_map_key_of_current_option '--filter|-f') |
|
| 1978 |
+ case "$key" in |
|
| 1979 |
+ id) |
|
| 1980 |
+ __docker_complete_nodes --cur "${cur##*=}" --id
|
|
| 1981 |
+ return |
|
| 1982 |
+ ;; |
|
| 1983 |
+ name) |
|
| 1984 |
+ __docker_complete_nodes --cur "${cur##*=}" --name
|
|
| 1985 |
+ return |
|
| 1986 |
+ ;; |
|
| 1987 |
+ esac |
|
| 1988 |
+ |
|
| 1989 |
+ case "$prev" in |
|
| 1990 |
+ --filter|-f) |
|
| 1991 |
+ COMPREPLY=( $( compgen -W "id label name" -S = -- "$cur" ) ) |
|
| 1992 |
+ __docker_nospace |
|
| 1993 |
+ return |
|
| 1994 |
+ ;; |
|
| 1995 |
+ esac |
|
| 1996 |
+ |
|
| 1997 |
+ case "$cur" in |
|
| 1998 |
+ -*) |
|
| 1999 |
+ COMPREPLY=( $( compgen -W "--filter -f --help --quiet -q" -- "$cur" ) ) |
|
| 2000 |
+ ;; |
|
| 2001 |
+ esac |
|
| 2002 |
+} |
|
| 2003 |
+ |
|
| 2004 |
+_docker_node_promote() {
|
|
| 2005 |
+ case "$cur" in |
|
| 2006 |
+ -*) |
|
| 2007 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 2008 |
+ ;; |
|
| 2009 |
+ *) |
|
| 2010 |
+ __docker_complete_nodes --filter role=worker |
|
| 2011 |
+ esac |
|
| 2012 |
+} |
|
| 2013 |
+ |
|
| 2014 |
+_docker_node_remove() {
|
|
| 2015 |
+ _docker_node_rm |
|
| 2016 |
+} |
|
| 2017 |
+ |
|
| 2018 |
+_docker_node_rm() {
|
|
| 2019 |
+ case "$cur" in |
|
| 2020 |
+ -*) |
|
| 2021 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 2022 |
+ ;; |
|
| 2023 |
+ *) |
|
| 2024 |
+ __docker_complete_nodes |
|
| 2025 |
+ esac |
|
| 2026 |
+} |
|
| 2027 |
+ |
|
| 2028 |
+_docker_node_ps() {
|
|
| 2029 |
+ local key=$(__docker_map_key_of_current_option '--filter|-f') |
|
| 2030 |
+ case "$key" in |
|
| 2031 |
+ desired-state) |
|
| 2032 |
+ COMPREPLY=( $( compgen -W "accepted running" -- "${cur##*=}" ) )
|
|
| 2033 |
+ return |
|
| 2034 |
+ ;; |
|
| 2035 |
+ name) |
|
| 2036 |
+ __docker_complete_services --cur "${cur##*=}" --name
|
|
| 2037 |
+ return |
|
| 2038 |
+ ;; |
|
| 2039 |
+ esac |
|
| 2040 |
+ |
|
| 2041 |
+ case "$prev" in |
|
| 2042 |
+ --filter|-f) |
|
| 2043 |
+ COMPREPLY=( $( compgen -W "desired-state id label name" -S = -- "$cur" ) ) |
|
| 2044 |
+ __docker_nospace |
|
| 2045 |
+ return |
|
| 2046 |
+ ;; |
|
| 2047 |
+ esac |
|
| 2048 |
+ |
|
| 2049 |
+ case "$cur" in |
|
| 2050 |
+ -*) |
|
| 2051 |
+ COMPREPLY=( $( compgen -W "--all -a --filter -f --help --no-resolve" -- "$cur" ) ) |
|
| 2052 |
+ ;; |
|
| 2053 |
+ *) |
|
| 2054 |
+ local counter=$(__docker_pos_first_nonflag '--filter|-f') |
|
| 2055 |
+ if [ $cword -eq $counter ]; then |
|
| 2056 |
+ __docker_complete_nodes_plus_self |
|
| 2057 |
+ fi |
|
| 2058 |
+ ;; |
|
| 2059 |
+ esac |
|
| 2060 |
+} |
|
| 2061 |
+ |
|
| 2062 |
+_docker_node_update() {
|
|
| 2063 |
+ case "$prev" in |
|
| 2064 |
+ --availability) |
|
| 2065 |
+ COMPREPLY=( $( compgen -W "active drain pause" -- "$cur" ) ) |
|
| 2066 |
+ return |
|
| 2067 |
+ ;; |
|
| 2068 |
+ --role) |
|
| 2069 |
+ COMPREPLY=( $( compgen -W "manager worker" -- "$cur" ) ) |
|
| 2070 |
+ return |
|
| 2071 |
+ ;; |
|
| 2072 |
+ --label-add|--label-rm) |
|
| 2073 |
+ return |
|
| 2074 |
+ ;; |
|
| 2075 |
+ esac |
|
| 2076 |
+ |
|
| 2077 |
+ case "$cur" in |
|
| 2078 |
+ -*) |
|
| 2079 |
+ COMPREPLY=( $( compgen -W "--availability --help --label-add --label-rm --role" -- "$cur" ) ) |
|
| 2080 |
+ ;; |
|
| 2081 |
+ *) |
|
| 2082 |
+ __docker_complete_nodes |
|
| 2083 |
+ esac |
|
| 2084 |
+} |
|
| 2085 |
+ |
|
| 2086 |
+_docker_pause() {
|
|
| 2087 |
+ case "$cur" in |
|
| 2088 |
+ -*) |
|
| 2089 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 2090 |
+ ;; |
|
| 2091 |
+ *) |
|
| 2092 |
+ local counter=$(__docker_pos_first_nonflag) |
|
| 2093 |
+ if [ $cword -eq $counter ]; then |
|
| 2094 |
+ __docker_complete_containers_pauseable |
|
| 2095 |
+ fi |
|
| 2096 |
+ ;; |
|
| 2097 |
+ esac |
|
| 2098 |
+} |
|
| 2099 |
+ |
|
| 2100 |
+_docker_port() {
|
|
| 2101 |
+ case "$cur" in |
|
| 2102 |
+ -*) |
|
| 2103 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 2104 |
+ ;; |
|
| 2105 |
+ *) |
|
| 2106 |
+ local counter=$(__docker_pos_first_nonflag) |
|
| 2107 |
+ if [ $cword -eq $counter ]; then |
|
| 2108 |
+ __docker_complete_containers_all |
|
| 2109 |
+ fi |
|
| 2110 |
+ ;; |
|
| 2111 |
+ esac |
|
| 2112 |
+} |
|
| 2113 |
+ |
|
| 2114 |
+_docker_ps() {
|
|
| 2115 |
+ local key=$(__docker_map_key_of_current_option '--filter|-f') |
|
| 2116 |
+ case "$key" in |
|
| 2117 |
+ ancestor) |
|
| 2118 |
+ cur="${cur##*=}"
|
|
| 2119 |
+ __docker_complete_images |
|
| 2120 |
+ return |
|
| 2121 |
+ ;; |
|
| 2122 |
+ before) |
|
| 2123 |
+ cur="${cur##*=}"
|
|
| 2124 |
+ __docker_complete_containers_all |
|
| 2125 |
+ return |
|
| 2126 |
+ ;; |
|
| 2127 |
+ id) |
|
| 2128 |
+ cur="${cur##*=}"
|
|
| 2129 |
+ __docker_complete_container_ids |
|
| 2130 |
+ return |
|
| 2131 |
+ ;; |
|
| 2132 |
+ name) |
|
| 2133 |
+ cur="${cur##*=}"
|
|
| 2134 |
+ __docker_complete_container_names |
|
| 2135 |
+ return |
|
| 2136 |
+ ;; |
|
| 2137 |
+ network) |
|
| 2138 |
+ cur="${cur##*=}"
|
|
| 2139 |
+ __docker_complete_networks |
|
| 2140 |
+ return |
|
| 2141 |
+ ;; |
|
| 2142 |
+ since) |
|
| 2143 |
+ cur="${cur##*=}"
|
|
| 2144 |
+ __docker_complete_containers_all |
|
| 2145 |
+ return |
|
| 2146 |
+ ;; |
|
| 2147 |
+ status) |
|
| 2148 |
+ COMPREPLY=( $( compgen -W "created dead exited paused restarting running" -- "${cur##*=}" ) )
|
|
| 2149 |
+ return |
|
| 2150 |
+ ;; |
|
| 2151 |
+ volume) |
|
| 2152 |
+ cur="${cur##*=}"
|
|
| 2153 |
+ __docker_complete_volumes |
|
| 2154 |
+ return |
|
| 2155 |
+ ;; |
|
| 2156 |
+ esac |
|
| 2157 |
+ |
|
| 2158 |
+ case "$prev" in |
|
| 2159 |
+ --filter|-f) |
|
| 2160 |
+ COMPREPLY=( $( compgen -S = -W "ancestor before exited id label name network since status volume" -- "$cur" ) ) |
|
| 2161 |
+ __docker_nospace |
|
| 2162 |
+ return |
|
| 2163 |
+ ;; |
|
| 2164 |
+ --format|-n) |
|
| 2165 |
+ return |
|
| 2166 |
+ ;; |
|
| 2167 |
+ esac |
|
| 2168 |
+ |
|
| 2169 |
+ case "$cur" in |
|
| 2170 |
+ -*) |
|
| 2171 |
+ COMPREPLY=( $( compgen -W "--all -a --filter -f --format --help --latest -l -n --no-trunc --quiet -q --size -s" -- "$cur" ) ) |
|
| 2172 |
+ ;; |
|
| 2173 |
+ esac |
|
| 2174 |
+} |
|
| 2175 |
+ |
|
| 2176 |
+_docker_pull() {
|
|
| 2177 |
+ case "$cur" in |
|
| 2178 |
+ -*) |
|
| 2179 |
+ COMPREPLY=( $( compgen -W "--all-tags -a --disable-content-trust=false --help" -- "$cur" ) ) |
|
| 2180 |
+ ;; |
|
| 2181 |
+ *) |
|
| 2182 |
+ local counter=$(__docker_pos_first_nonflag) |
|
| 2183 |
+ if [ $cword -eq $counter ]; then |
|
| 2184 |
+ for arg in "${COMP_WORDS[@]}"; do
|
|
| 2185 |
+ case "$arg" in |
|
| 2186 |
+ --all-tags|-a) |
|
| 2187 |
+ __docker_complete_image_repos |
|
| 2188 |
+ return |
|
| 2189 |
+ ;; |
|
| 2190 |
+ esac |
|
| 2191 |
+ done |
|
| 2192 |
+ __docker_complete_image_repos_and_tags |
|
| 2193 |
+ fi |
|
| 2194 |
+ ;; |
|
| 2195 |
+ esac |
|
| 2196 |
+} |
|
| 2197 |
+ |
|
| 2198 |
+_docker_push() {
|
|
| 2199 |
+ case "$cur" in |
|
| 2200 |
+ -*) |
|
| 2201 |
+ COMPREPLY=( $( compgen -W "--disable-content-trust=false --help" -- "$cur" ) ) |
|
| 2202 |
+ ;; |
|
| 2203 |
+ *) |
|
| 2204 |
+ local counter=$(__docker_pos_first_nonflag) |
|
| 2205 |
+ if [ $cword -eq $counter ]; then |
|
| 2206 |
+ __docker_complete_image_repos_and_tags |
|
| 2207 |
+ fi |
|
| 2208 |
+ ;; |
|
| 2209 |
+ esac |
|
| 2210 |
+} |
|
| 2211 |
+ |
|
| 2212 |
+_docker_rename() {
|
|
| 2213 |
+ case "$cur" in |
|
| 2214 |
+ -*) |
|
| 2215 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 2216 |
+ ;; |
|
| 2217 |
+ *) |
|
| 2218 |
+ local counter=$(__docker_pos_first_nonflag) |
|
| 2219 |
+ if [ $cword -eq $counter ]; then |
|
| 2220 |
+ __docker_complete_containers_all |
|
| 2221 |
+ fi |
|
| 2222 |
+ ;; |
|
| 2223 |
+ esac |
|
| 2224 |
+} |
|
| 2225 |
+ |
|
| 2226 |
+_docker_restart() {
|
|
| 2227 |
+ case "$prev" in |
|
| 2228 |
+ --time|-t) |
|
| 2229 |
+ return |
|
| 2230 |
+ ;; |
|
| 2231 |
+ esac |
|
| 2232 |
+ |
|
| 2233 |
+ case "$cur" in |
|
| 2234 |
+ -*) |
|
| 2235 |
+ COMPREPLY=( $( compgen -W "--help --time -t" -- "$cur" ) ) |
|
| 2236 |
+ ;; |
|
| 2237 |
+ *) |
|
| 2238 |
+ __docker_complete_containers_all |
|
| 2239 |
+ ;; |
|
| 2240 |
+ esac |
|
| 2241 |
+} |
|
| 2242 |
+ |
|
| 2243 |
+_docker_rm() {
|
|
| 2244 |
+ case "$cur" in |
|
| 2245 |
+ -*) |
|
| 2246 |
+ COMPREPLY=( $( compgen -W "--force -f --help --link -l --volumes -v" -- "$cur" ) ) |
|
| 2247 |
+ ;; |
|
| 2248 |
+ *) |
|
| 2249 |
+ for arg in "${COMP_WORDS[@]}"; do
|
|
| 2250 |
+ case "$arg" in |
|
| 2251 |
+ --force|-f) |
|
| 2252 |
+ __docker_complete_containers_all |
|
| 2253 |
+ return |
|
| 2254 |
+ ;; |
|
| 2255 |
+ esac |
|
| 2256 |
+ done |
|
| 2257 |
+ __docker_complete_containers_stopped |
|
| 2258 |
+ ;; |
|
| 2259 |
+ esac |
|
| 2260 |
+} |
|
| 2261 |
+ |
|
| 2262 |
+_docker_rmi() {
|
|
| 2263 |
+ case "$cur" in |
|
| 2264 |
+ -*) |
|
| 2265 |
+ COMPREPLY=( $( compgen -W "--force -f --help --no-prune" -- "$cur" ) ) |
|
| 2266 |
+ ;; |
|
| 2267 |
+ *) |
|
| 2268 |
+ __docker_complete_images |
|
| 2269 |
+ ;; |
|
| 2270 |
+ esac |
|
| 2271 |
+} |
|
| 2272 |
+ |
|
| 2273 |
+_docker_run() {
|
|
| 2274 |
+ local options_with_args=" |
|
| 2275 |
+ --add-host |
|
| 2276 |
+ --attach -a |
|
| 2277 |
+ --blkio-weight |
|
| 2278 |
+ --blkio-weight-device |
|
| 2279 |
+ --cap-add |
|
| 2280 |
+ --cap-drop |
|
| 2281 |
+ --cgroup-parent |
|
| 2282 |
+ --cidfile |
|
| 2283 |
+ --cpu-period |
|
| 2284 |
+ --cpu-quota |
|
| 2285 |
+ --cpuset-cpus |
|
| 2286 |
+ --cpuset-mems |
|
| 2287 |
+ --cpu-shares -c |
|
| 2288 |
+ --device |
|
| 2289 |
+ --device-read-bps |
|
| 2290 |
+ --device-read-iops |
|
| 2291 |
+ --device-write-bps |
|
| 2292 |
+ --device-write-iops |
|
| 2293 |
+ --dns |
|
| 2294 |
+ --dns-opt |
|
| 2295 |
+ --dns-search |
|
| 2296 |
+ --entrypoint |
|
| 2297 |
+ --env -e |
|
| 2298 |
+ --env-file |
|
| 2299 |
+ --expose |
|
| 2300 |
+ --group-add |
|
| 2301 |
+ --hostname -h |
|
| 2302 |
+ --ip |
|
| 2303 |
+ --ip6 |
|
| 2304 |
+ --ipc |
|
| 2305 |
+ --isolation |
|
| 2306 |
+ --kernel-memory |
|
| 2307 |
+ --label-file |
|
| 2308 |
+ --label -l |
|
| 2309 |
+ --link |
|
| 2310 |
+ --link-local-ip |
|
| 2311 |
+ --log-driver |
|
| 2312 |
+ --log-opt |
|
| 2313 |
+ --mac-address |
|
| 2314 |
+ --memory -m |
|
| 2315 |
+ --memory-swap |
|
| 2316 |
+ --memory-swappiness |
|
| 2317 |
+ --memory-reservation |
|
| 2318 |
+ --name |
|
| 2319 |
+ --network |
|
| 2320 |
+ --network-alias |
|
| 2321 |
+ --oom-score-adj |
|
| 2322 |
+ --pid |
|
| 2323 |
+ --pids-limit |
|
| 2324 |
+ --publish -p |
|
| 2325 |
+ --restart |
|
| 2326 |
+ --runtime |
|
| 2327 |
+ --security-opt |
|
| 2328 |
+ --shm-size |
|
| 2329 |
+ --stop-signal |
|
| 2330 |
+ --storage-opt |
|
| 2331 |
+ --tmpfs |
|
| 2332 |
+ --sysctl |
|
| 2333 |
+ --ulimit |
|
| 2334 |
+ --user -u |
|
| 2335 |
+ --userns |
|
| 2336 |
+ --uts |
|
| 2337 |
+ --volume-driver |
|
| 2338 |
+ --volumes-from |
|
| 2339 |
+ --volume -v |
|
| 2340 |
+ --workdir -w |
|
| 2341 |
+ " |
|
| 2342 |
+ |
|
| 2343 |
+ local boolean_options=" |
|
| 2344 |
+ --disable-content-trust=false |
|
| 2345 |
+ --help |
|
| 2346 |
+ --interactive -i |
|
| 2347 |
+ --oom-kill-disable |
|
| 2348 |
+ --privileged |
|
| 2349 |
+ --publish-all -P |
|
| 2350 |
+ --read-only |
|
| 2351 |
+ --tty -t |
|
| 2352 |
+ " |
|
| 2353 |
+ |
|
| 2354 |
+ if [ "$command" = "run" ] ; then |
|
| 2355 |
+ options_with_args="$options_with_args |
|
| 2356 |
+ --detach-keys |
|
| 2357 |
+ --health-cmd |
|
| 2358 |
+ --health-interval |
|
| 2359 |
+ --health-retries |
|
| 2360 |
+ --health-timeout |
|
| 2361 |
+ " |
|
| 2362 |
+ boolean_options="$boolean_options |
|
| 2363 |
+ --detach -d |
|
| 2364 |
+ --no-healthcheck |
|
| 2365 |
+ --rm |
|
| 2366 |
+ --sig-proxy=false |
|
| 2367 |
+ " |
|
| 2368 |
+ __docker_complete_detach-keys && return |
|
| 2369 |
+ fi |
|
| 2370 |
+ |
|
| 2371 |
+ local all_options="$options_with_args $boolean_options" |
|
| 2372 |
+ |
|
| 2373 |
+ |
|
| 2374 |
+ __docker_complete_log_driver_options && return |
|
| 2375 |
+ __docker_complete_restart && return |
|
| 2376 |
+ |
|
| 2377 |
+ local key=$(__docker_map_key_of_current_option '--security-opt') |
|
| 2378 |
+ case "$key" in |
|
| 2379 |
+ label) |
|
| 2380 |
+ [[ $cur == *: ]] && return |
|
| 2381 |
+ COMPREPLY=( $( compgen -W "user: role: type: level: disable" -- "${cur##*=}") )
|
|
| 2382 |
+ if [ "${COMPREPLY[*]}" != "disable" ] ; then
|
|
| 2383 |
+ __docker_nospace |
|
| 2384 |
+ fi |
|
| 2385 |
+ return |
|
| 2386 |
+ ;; |
|
| 2387 |
+ seccomp) |
|
| 2388 |
+ local cur=${cur##*=}
|
|
| 2389 |
+ _filedir |
|
| 2390 |
+ COMPREPLY+=( $( compgen -W "unconfined" -- "$cur" ) ) |
|
| 2391 |
+ return |
|
| 2392 |
+ ;; |
|
| 2393 |
+ esac |
|
| 2394 |
+ |
|
| 2395 |
+ case "$prev" in |
|
| 2396 |
+ --add-host) |
|
| 2397 |
+ case "$cur" in |
|
| 2398 |
+ *:) |
|
| 2399 |
+ __docker_complete_resolved_hostname |
|
| 2400 |
+ return |
|
| 2401 |
+ ;; |
|
| 2402 |
+ esac |
|
| 2403 |
+ ;; |
|
| 2404 |
+ --attach|-a) |
|
| 2405 |
+ COMPREPLY=( $( compgen -W 'stdin stdout stderr' -- "$cur" ) ) |
|
| 2406 |
+ return |
|
| 2407 |
+ ;; |
|
| 2408 |
+ --cap-add|--cap-drop) |
|
| 2409 |
+ __docker_complete_capabilities |
|
| 2410 |
+ return |
|
| 2411 |
+ ;; |
|
| 2412 |
+ --cidfile|--env-file|--label-file) |
|
| 2413 |
+ _filedir |
|
| 2414 |
+ return |
|
| 2415 |
+ ;; |
|
| 2416 |
+ --device|--tmpfs|--volume|-v) |
|
| 2417 |
+ case "$cur" in |
|
| 2418 |
+ *:*) |
|
| 2419 |
+ # TODO somehow do _filedir for stuff inside the image, if it's already specified (which is also somewhat difficult to determine) |
|
| 2420 |
+ ;; |
|
| 2421 |
+ '') |
|
| 2422 |
+ COMPREPLY=( $( compgen -W '/' -- "$cur" ) ) |
|
| 2423 |
+ __docker_nospace |
|
| 2424 |
+ ;; |
|
| 2425 |
+ /*) |
|
| 2426 |
+ _filedir |
|
| 2427 |
+ __docker_nospace |
|
| 2428 |
+ ;; |
|
| 2429 |
+ esac |
|
| 2430 |
+ return |
|
| 2431 |
+ ;; |
|
| 2432 |
+ --env|-e) |
|
| 2433 |
+ COMPREPLY=( $( compgen -e -- "$cur" ) ) |
|
| 2434 |
+ __docker_nospace |
|
| 2435 |
+ return |
|
| 2436 |
+ ;; |
|
| 2437 |
+ --ipc) |
|
| 2438 |
+ case "$cur" in |
|
| 2439 |
+ *:*) |
|
| 2440 |
+ cur="${cur#*:}"
|
|
| 2441 |
+ __docker_complete_containers_running |
|
| 2442 |
+ ;; |
|
| 2443 |
+ *) |
|
| 2444 |
+ COMPREPLY=( $( compgen -W 'host container:' -- "$cur" ) ) |
|
| 2445 |
+ if [ "$COMPREPLY" = "container:" ]; then |
|
| 2446 |
+ __docker_nospace |
|
| 2447 |
+ fi |
|
| 2448 |
+ ;; |
|
| 2449 |
+ esac |
|
| 2450 |
+ return |
|
| 2451 |
+ ;; |
|
| 2452 |
+ --isolation) |
|
| 2453 |
+ __docker_complete_isolation |
|
| 2454 |
+ return |
|
| 2455 |
+ ;; |
|
| 2456 |
+ --link) |
|
| 2457 |
+ case "$cur" in |
|
| 2458 |
+ *:*) |
|
| 2459 |
+ ;; |
|
| 2460 |
+ *) |
|
| 2461 |
+ __docker_complete_containers_running |
|
| 2462 |
+ COMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) )
|
|
| 2463 |
+ __docker_nospace |
|
| 2464 |
+ ;; |
|
| 2465 |
+ esac |
|
| 2466 |
+ return |
|
| 2467 |
+ ;; |
|
| 2468 |
+ --log-driver) |
|
| 2469 |
+ __docker_complete_log_drivers |
|
| 2470 |
+ return |
|
| 2471 |
+ ;; |
|
| 2472 |
+ --log-opt) |
|
| 2473 |
+ __docker_complete_log_options |
|
| 2474 |
+ return |
|
| 2475 |
+ ;; |
|
| 2476 |
+ --network) |
|
| 2477 |
+ case "$cur" in |
|
| 2478 |
+ container:*) |
|
| 2479 |
+ local cur=${cur#*:}
|
|
| 2480 |
+ __docker_complete_containers_all |
|
| 2481 |
+ ;; |
|
| 2482 |
+ *) |
|
| 2483 |
+ COMPREPLY=( $( compgen -W "$(__docker_plugins Network) $(__docker_networks) container:" -- "$cur") ) |
|
| 2484 |
+ if [ "${COMPREPLY[*]}" = "container:" ] ; then
|
|
| 2485 |
+ __docker_nospace |
|
| 2486 |
+ fi |
|
| 2487 |
+ ;; |
|
| 2488 |
+ esac |
|
| 2489 |
+ return |
|
| 2490 |
+ ;; |
|
| 2491 |
+ --pid) |
|
| 2492 |
+ case "$cur" in |
|
| 2493 |
+ *:*) |
|
| 2494 |
+ cur="${cur#*:}"
|
|
| 2495 |
+ __docker_complete_containers_running |
|
| 2496 |
+ ;; |
|
| 2497 |
+ *) |
|
| 2498 |
+ COMPREPLY=( $( compgen -W 'host container:' -- "$cur" ) ) |
|
| 2499 |
+ if [ "$COMPREPLY" = "container:" ]; then |
|
| 2500 |
+ __docker_nospace |
|
| 2501 |
+ fi |
|
| 2502 |
+ ;; |
|
| 2503 |
+ esac |
|
| 2504 |
+ return |
|
| 2505 |
+ ;; |
|
| 2506 |
+ --runtime) |
|
| 2507 |
+ __docker_complete_runtimes |
|
| 2508 |
+ return |
|
| 2509 |
+ ;; |
|
| 2510 |
+ --security-opt) |
|
| 2511 |
+ COMPREPLY=( $( compgen -W "apparmor= label= no-new-privileges seccomp=" -- "$cur") ) |
|
| 2512 |
+ if [ "${COMPREPLY[*]}" != "no-new-privileges" ] ; then
|
|
| 2513 |
+ __docker_nospace |
|
| 2514 |
+ fi |
|
| 2515 |
+ return |
|
| 2516 |
+ ;; |
|
| 2517 |
+ --storage-opt) |
|
| 2518 |
+ COMPREPLY=( $( compgen -W "size" -S = -- "$cur") ) |
|
| 2519 |
+ __docker_nospace |
|
| 2520 |
+ return |
|
| 2521 |
+ ;; |
|
| 2522 |
+ --user|-u) |
|
| 2523 |
+ __docker_complete_user_group |
|
| 2524 |
+ return |
|
| 2525 |
+ ;; |
|
| 2526 |
+ --userns) |
|
| 2527 |
+ COMPREPLY=( $( compgen -W "host" -- "$cur" ) ) |
|
| 2528 |
+ return |
|
| 2529 |
+ ;; |
|
| 2530 |
+ --volume-driver) |
|
| 2531 |
+ __docker_complete_plugins Volume |
|
| 2532 |
+ return |
|
| 2533 |
+ ;; |
|
| 2534 |
+ --volumes-from) |
|
| 2535 |
+ __docker_complete_containers_all |
|
| 2536 |
+ return |
|
| 2537 |
+ ;; |
|
| 2538 |
+ $(__docker_to_extglob "$options_with_args") ) |
|
| 2539 |
+ return |
|
| 2540 |
+ ;; |
|
| 2541 |
+ esac |
|
| 2542 |
+ |
|
| 2543 |
+ case "$cur" in |
|
| 2544 |
+ -*) |
|
| 2545 |
+ COMPREPLY=( $( compgen -W "$all_options" -- "$cur" ) ) |
|
| 2546 |
+ ;; |
|
| 2547 |
+ *) |
|
| 2548 |
+ local counter=$( __docker_pos_first_nonflag $( __docker_to_alternatives "$options_with_args" ) ) |
|
| 2549 |
+ if [ $cword -eq $counter ]; then |
|
| 2550 |
+ __docker_complete_images |
|
| 2551 |
+ fi |
|
| 2552 |
+ ;; |
|
| 2553 |
+ esac |
|
| 2554 |
+} |
|
| 2555 |
+ |
|
| 2556 |
+_docker_save() {
|
|
| 2557 |
+ case "$prev" in |
|
| 2558 |
+ --output|-o) |
|
| 2559 |
+ _filedir |
|
| 2560 |
+ return |
|
| 2561 |
+ ;; |
|
| 2562 |
+ esac |
|
| 2563 |
+ |
|
| 2564 |
+ case "$cur" in |
|
| 2565 |
+ -*) |
|
| 2566 |
+ COMPREPLY=( $( compgen -W "--help --output -o" -- "$cur" ) ) |
|
| 2567 |
+ ;; |
|
| 2568 |
+ *) |
|
| 2569 |
+ __docker_complete_images |
|
| 2570 |
+ ;; |
|
| 2571 |
+ esac |
|
| 2572 |
+} |
|
| 2573 |
+ |
|
| 2574 |
+_docker_search() {
|
|
| 2575 |
+ local key=$(__docker_map_key_of_current_option '--filter|-f') |
|
| 2576 |
+ case "$key" in |
|
| 2577 |
+ is-automated) |
|
| 2578 |
+ COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )
|
|
| 2579 |
+ return |
|
| 2580 |
+ ;; |
|
| 2581 |
+ is-official) |
|
| 2582 |
+ COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) )
|
|
| 2583 |
+ return |
|
| 2584 |
+ ;; |
|
| 2585 |
+ esac |
|
| 2586 |
+ |
|
| 2587 |
+ case "$prev" in |
|
| 2588 |
+ --filter|-f) |
|
| 2589 |
+ COMPREPLY=( $( compgen -S = -W "is-automated is-official stars" -- "$cur" ) ) |
|
| 2590 |
+ __docker_nospace |
|
| 2591 |
+ return |
|
| 2592 |
+ ;; |
|
| 2593 |
+ --limit) |
|
| 2594 |
+ return |
|
| 2595 |
+ ;; |
|
| 2596 |
+ esac |
|
| 2597 |
+ |
|
| 2598 |
+ case "$cur" in |
|
| 2599 |
+ -*) |
|
| 2600 |
+ COMPREPLY=( $( compgen -W "--filter --help --limit --no-trunc" -- "$cur" ) ) |
|
| 2601 |
+ ;; |
|
| 2602 |
+ esac |
|
| 2603 |
+} |
|
| 2604 |
+ |
|
| 2605 |
+_docker_start() {
|
|
| 2606 |
+ __docker_complete_detach-keys && return |
|
| 2607 |
+ |
|
| 2608 |
+ case "$cur" in |
|
| 2609 |
+ -*) |
|
| 2610 |
+ COMPREPLY=( $( compgen -W "--attach -a --detach-keys --help --interactive -i" -- "$cur" ) ) |
|
| 2611 |
+ ;; |
|
| 2612 |
+ *) |
|
| 2613 |
+ __docker_complete_containers_stopped |
|
| 2614 |
+ ;; |
|
| 2615 |
+ esac |
|
| 2616 |
+} |
|
| 2617 |
+ |
|
| 2618 |
+_docker_stats() {
|
|
| 2619 |
+ case "$cur" in |
|
| 2620 |
+ -*) |
|
| 2621 |
+ COMPREPLY=( $( compgen -W "--all -a --help --no-stream" -- "$cur" ) ) |
|
| 2622 |
+ ;; |
|
| 2623 |
+ *) |
|
| 2624 |
+ __docker_complete_containers_running |
|
| 2625 |
+ ;; |
|
| 2626 |
+ esac |
|
| 2627 |
+} |
|
| 2628 |
+ |
|
| 2629 |
+_docker_stop() {
|
|
| 2630 |
+ case "$prev" in |
|
| 2631 |
+ --time|-t) |
|
| 2632 |
+ return |
|
| 2633 |
+ ;; |
|
| 2634 |
+ esac |
|
| 2635 |
+ |
|
| 2636 |
+ case "$cur" in |
|
| 2637 |
+ -*) |
|
| 2638 |
+ COMPREPLY=( $( compgen -W "--help --time -t" -- "$cur" ) ) |
|
| 2639 |
+ ;; |
|
| 2640 |
+ *) |
|
| 2641 |
+ __docker_complete_containers_running |
|
| 2642 |
+ ;; |
|
| 2643 |
+ esac |
|
| 2644 |
+} |
|
| 2645 |
+ |
|
| 2646 |
+_docker_tag() {
|
|
| 2647 |
+ case "$cur" in |
|
| 2648 |
+ -*) |
|
| 2649 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 2650 |
+ ;; |
|
| 2651 |
+ *) |
|
| 2652 |
+ local counter=$(__docker_pos_first_nonflag) |
|
| 2653 |
+ |
|
| 2654 |
+ if [ $cword -eq $counter ]; then |
|
| 2655 |
+ __docker_complete_image_repos_and_tags |
|
| 2656 |
+ return |
|
| 2657 |
+ fi |
|
| 2658 |
+ (( counter++ )) |
|
| 2659 |
+ |
|
| 2660 |
+ if [ $cword -eq $counter ]; then |
|
| 2661 |
+ __docker_complete_image_repos_and_tags |
|
| 2662 |
+ return |
|
| 2663 |
+ fi |
|
| 2664 |
+ ;; |
|
| 2665 |
+ esac |
|
| 2666 |
+} |
|
| 2667 |
+ |
|
| 2668 |
+_docker_unpause() {
|
|
| 2669 |
+ case "$cur" in |
|
| 2670 |
+ -*) |
|
| 2671 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 2672 |
+ ;; |
|
| 2673 |
+ *) |
|
| 2674 |
+ local counter=$(__docker_pos_first_nonflag) |
|
| 2675 |
+ if [ $cword -eq $counter ]; then |
|
| 2676 |
+ __docker_complete_containers_unpauseable |
|
| 2677 |
+ fi |
|
| 2678 |
+ ;; |
|
| 2679 |
+ esac |
|
| 2680 |
+} |
|
| 2681 |
+ |
|
| 2682 |
+_docker_update() {
|
|
| 2683 |
+ local options_with_args=" |
|
| 2684 |
+ --blkio-weight |
|
| 2685 |
+ --cpu-period |
|
| 2686 |
+ --cpu-quota |
|
| 2687 |
+ --cpuset-cpus |
|
| 2688 |
+ --cpuset-mems |
|
| 2689 |
+ --cpu-shares -c |
|
| 2690 |
+ --kernel-memory |
|
| 2691 |
+ --memory -m |
|
| 2692 |
+ --memory-reservation |
|
| 2693 |
+ --memory-swap |
|
| 2694 |
+ --restart |
|
| 2695 |
+ " |
|
| 2696 |
+ |
|
| 2697 |
+ local boolean_options=" |
|
| 2698 |
+ --help |
|
| 2699 |
+ " |
|
| 2700 |
+ |
|
| 2701 |
+ local all_options="$options_with_args $boolean_options" |
|
| 2702 |
+ |
|
| 2703 |
+ __docker_complete_restart && return |
|
| 2704 |
+ |
|
| 2705 |
+ case "$prev" in |
|
| 2706 |
+ $(__docker_to_extglob "$options_with_args") ) |
|
| 2707 |
+ return |
|
| 2708 |
+ ;; |
|
| 2709 |
+ esac |
|
| 2710 |
+ |
|
| 2711 |
+ case "$cur" in |
|
| 2712 |
+ -*) |
|
| 2713 |
+ COMPREPLY=( $( compgen -W "$all_options" -- "$cur" ) ) |
|
| 2714 |
+ ;; |
|
| 2715 |
+ *) |
|
| 2716 |
+ __docker_complete_containers_all |
|
| 2717 |
+ ;; |
|
| 2718 |
+ esac |
|
| 2719 |
+} |
|
| 2720 |
+ |
|
| 2721 |
+_docker_top() {
|
|
| 2722 |
+ case "$cur" in |
|
| 2723 |
+ -*) |
|
| 2724 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 2725 |
+ ;; |
|
| 2726 |
+ *) |
|
| 2727 |
+ local counter=$(__docker_pos_first_nonflag) |
|
| 2728 |
+ if [ $cword -eq $counter ]; then |
|
| 2729 |
+ __docker_complete_containers_running |
|
| 2730 |
+ fi |
|
| 2731 |
+ ;; |
|
| 2732 |
+ esac |
|
| 2733 |
+} |
|
| 2734 |
+ |
|
| 2735 |
+_docker_version() {
|
|
| 2736 |
+ case "$cur" in |
|
| 2737 |
+ -*) |
|
| 2738 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 2739 |
+ ;; |
|
| 2740 |
+ esac |
|
| 2741 |
+} |
|
| 2742 |
+ |
|
| 2743 |
+_docker_volume_create() {
|
|
| 2744 |
+ case "$prev" in |
|
| 2745 |
+ --driver|-d) |
|
| 2746 |
+ __docker_complete_plugins Volume |
|
| 2747 |
+ return |
|
| 2748 |
+ ;; |
|
| 2749 |
+ --label|--name|--opt|-o) |
|
| 2750 |
+ return |
|
| 2751 |
+ ;; |
|
| 2752 |
+ esac |
|
| 2753 |
+ |
|
| 2754 |
+ case "$cur" in |
|
| 2755 |
+ -*) |
|
| 2756 |
+ COMPREPLY=( $( compgen -W "--driver -d --help --label --name --opt -o" -- "$cur" ) ) |
|
| 2757 |
+ ;; |
|
| 2758 |
+ esac |
|
| 2759 |
+} |
|
| 2760 |
+ |
|
| 2761 |
+_docker_volume_inspect() {
|
|
| 2762 |
+ case "$prev" in |
|
| 2763 |
+ --format|-f) |
|
| 2764 |
+ return |
|
| 2765 |
+ ;; |
|
| 2766 |
+ esac |
|
| 2767 |
+ |
|
| 2768 |
+ case "$cur" in |
|
| 2769 |
+ -*) |
|
| 2770 |
+ COMPREPLY=( $( compgen -W "--format -f --help" -- "$cur" ) ) |
|
| 2771 |
+ ;; |
|
| 2772 |
+ *) |
|
| 2773 |
+ __docker_complete_volumes |
|
| 2774 |
+ ;; |
|
| 2775 |
+ esac |
|
| 2776 |
+} |
|
| 2777 |
+ |
|
| 2778 |
+_docker_volume_ls() {
|
|
| 2779 |
+ local key=$(__docker_map_key_of_current_option '--filter|-f') |
|
| 2780 |
+ case "$key" in |
|
| 2781 |
+ dangling) |
|
| 2782 |
+ COMPREPLY=( $( compgen -W "true false" -- "${cur##*=}" ) )
|
|
| 2783 |
+ return |
|
| 2784 |
+ ;; |
|
| 2785 |
+ driver) |
|
| 2786 |
+ cur=${cur##*=}
|
|
| 2787 |
+ __docker_complete_plugins Volume |
|
| 2788 |
+ return |
|
| 2789 |
+ ;; |
|
| 2790 |
+ name) |
|
| 2791 |
+ cur=${cur##*=}
|
|
| 2792 |
+ __docker_complete_volumes |
|
| 2793 |
+ return |
|
| 2794 |
+ ;; |
|
| 2795 |
+ esac |
|
| 2796 |
+ |
|
| 2797 |
+ case "$prev" in |
|
| 2798 |
+ --filter|-f) |
|
| 2799 |
+ COMPREPLY=( $( compgen -S = -W "dangling driver name" -- "$cur" ) ) |
|
| 2800 |
+ __docker_nospace |
|
| 2801 |
+ return |
|
| 2802 |
+ ;; |
|
| 2803 |
+ esac |
|
| 2804 |
+ |
|
| 2805 |
+ case "$cur" in |
|
| 2806 |
+ -*) |
|
| 2807 |
+ COMPREPLY=( $( compgen -W "--filter -f --help --quiet -q" -- "$cur" ) ) |
|
| 2808 |
+ ;; |
|
| 2809 |
+ esac |
|
| 2810 |
+} |
|
| 2811 |
+ |
|
| 2812 |
+_docker_volume_rm() {
|
|
| 2813 |
+ case "$cur" in |
|
| 2814 |
+ -*) |
|
| 2815 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 2816 |
+ ;; |
|
| 2817 |
+ *) |
|
| 2818 |
+ __docker_complete_volumes |
|
| 2819 |
+ ;; |
|
| 2820 |
+ esac |
|
| 2821 |
+} |
|
| 2822 |
+ |
|
| 2823 |
+_docker_volume() {
|
|
| 2824 |
+ local subcommands=" |
|
| 2825 |
+ create |
|
| 2826 |
+ inspect |
|
| 2827 |
+ ls |
|
| 2828 |
+ rm |
|
| 2829 |
+ " |
|
| 2830 |
+ __docker_subcommands "$subcommands" && return |
|
| 2831 |
+ |
|
| 2832 |
+ case "$cur" in |
|
| 2833 |
+ -*) |
|
| 2834 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 2835 |
+ ;; |
|
| 2836 |
+ *) |
|
| 2837 |
+ COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) |
|
| 2838 |
+ ;; |
|
| 2839 |
+ esac |
|
| 2840 |
+} |
|
| 2841 |
+ |
|
| 2842 |
+_docker_wait() {
|
|
| 2843 |
+ case "$cur" in |
|
| 2844 |
+ -*) |
|
| 2845 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 2846 |
+ ;; |
|
| 2847 |
+ *) |
|
| 2848 |
+ __docker_complete_containers_all |
|
| 2849 |
+ ;; |
|
| 2850 |
+ esac |
|
| 2851 |
+} |
|
| 2852 |
+ |
|
| 2853 |
+_docker() {
|
|
| 2854 |
+ local previous_extglob_setting=$(shopt -p extglob) |
|
| 2855 |
+ shopt -s extglob |
|
| 2856 |
+ |
|
| 2857 |
+ local commands=( |
|
| 2858 |
+ attach |
|
| 2859 |
+ build |
|
| 2860 |
+ commit |
|
| 2861 |
+ cp |
|
| 2862 |
+ create |
|
| 2863 |
+ daemon |
|
| 2864 |
+ diff |
|
| 2865 |
+ events |
|
| 2866 |
+ exec |
|
| 2867 |
+ export |
|
| 2868 |
+ history |
|
| 2869 |
+ images |
|
| 2870 |
+ import |
|
| 2871 |
+ info |
|
| 2872 |
+ inspect |
|
| 2873 |
+ kill |
|
| 2874 |
+ load |
|
| 2875 |
+ login |
|
| 2876 |
+ logout |
|
| 2877 |
+ logs |
|
| 2878 |
+ network |
|
| 2879 |
+ node |
|
| 2880 |
+ pause |
|
| 2881 |
+ port |
|
| 2882 |
+ ps |
|
| 2883 |
+ pull |
|
| 2884 |
+ push |
|
| 2885 |
+ rename |
|
| 2886 |
+ restart |
|
| 2887 |
+ rm |
|
| 2888 |
+ rmi |
|
| 2889 |
+ run |
|
| 2890 |
+ save |
|
| 2891 |
+ search |
|
| 2892 |
+ service |
|
| 2893 |
+ start |
|
| 2894 |
+ stats |
|
| 2895 |
+ stop |
|
| 2896 |
+ swarm |
|
| 2897 |
+ tag |
|
| 2898 |
+ top |
|
| 2899 |
+ unpause |
|
| 2900 |
+ update |
|
| 2901 |
+ version |
|
| 2902 |
+ volume |
|
| 2903 |
+ wait |
|
| 2904 |
+ ) |
|
| 2905 |
+ |
|
| 2906 |
+ # These options are valid as global options for all client commands |
|
| 2907 |
+ # and valid as command options for `docker daemon` |
|
| 2908 |
+ local global_boolean_options=" |
|
| 2909 |
+ --debug -D |
|
| 2910 |
+ --tls |
|
| 2911 |
+ --tlsverify |
|
| 2912 |
+ " |
|
| 2913 |
+ local global_options_with_args=" |
|
| 2914 |
+ --config |
|
| 2915 |
+ --host -H |
|
| 2916 |
+ --log-level -l |
|
| 2917 |
+ --tlscacert |
|
| 2918 |
+ --tlscert |
|
| 2919 |
+ --tlskey |
|
| 2920 |
+ " |
|
| 2921 |
+ |
|
| 2922 |
+ local host config |
|
| 2923 |
+ |
|
| 2924 |
+ COMPREPLY=() |
|
| 2925 |
+ local cur prev words cword |
|
| 2926 |
+ _get_comp_words_by_ref -n : cur prev words cword |
|
| 2927 |
+ |
|
| 2928 |
+ local command='docker' command_pos=0 subcommand_pos |
|
| 2929 |
+ local counter=1 |
|
| 2930 |
+ while [ $counter -lt $cword ]; do |
|
| 2931 |
+ case "${words[$counter]}" in
|
|
| 2932 |
+ # save host so that completion can use custom daemon |
|
| 2933 |
+ --host|-H) |
|
| 2934 |
+ (( counter++ )) |
|
| 2935 |
+ host="${words[$counter]}"
|
|
| 2936 |
+ ;; |
|
| 2937 |
+ # save config so that completion can use custom configuration directories |
|
| 2938 |
+ --config) |
|
| 2939 |
+ (( counter++ )) |
|
| 2940 |
+ config="${words[$counter]}"
|
|
| 2941 |
+ ;; |
|
| 2942 |
+ $(__docker_to_extglob "$global_options_with_args") ) |
|
| 2943 |
+ (( counter++ )) |
|
| 2944 |
+ ;; |
|
| 2945 |
+ -*) |
|
| 2946 |
+ ;; |
|
| 2947 |
+ =) |
|
| 2948 |
+ (( counter++ )) |
|
| 2949 |
+ ;; |
|
| 2950 |
+ *) |
|
| 2951 |
+ command="${words[$counter]}"
|
|
| 2952 |
+ command_pos=$counter |
|
| 2953 |
+ break |
|
| 2954 |
+ ;; |
|
| 2955 |
+ esac |
|
| 2956 |
+ (( counter++ )) |
|
| 2957 |
+ done |
|
| 2958 |
+ |
|
| 2959 |
+ local binary="${words[0]}"
|
|
| 2960 |
+ if [[ $binary == ?(*/)dockerd ]] ; then |
|
| 2961 |
+ # for the dockerd binary, we reuse completion of `docker daemon`. |
|
| 2962 |
+ # dockerd does not have subcommands and global options. |
|
| 2963 |
+ command=daemon |
|
| 2964 |
+ command_pos=0 |
|
| 2965 |
+ fi |
|
| 2966 |
+ |
|
| 2967 |
+ local completions_func=_docker_${command}
|
|
| 2968 |
+ declare -F $completions_func >/dev/null && $completions_func |
|
| 2969 |
+ |
|
| 2970 |
+ eval "$previous_extglob_setting" |
|
| 2971 |
+ return 0 |
|
| 2972 |
+} |
|
| 2973 |
+ |
|
| 2974 |
+eval "$__docker_previous_extglob_setting" |
|
| 2975 |
+unset __docker_previous_extglob_setting |
|
| 2976 |
+ |
|
| 2977 |
+complete -F _docker docker dockerd |
| ... | ... |
@@ -4,7 +4,7 @@ Documentation=https://containerd.tools/ |
| 4 | 4 |
After=network.target |
| 5 | 5 |
|
| 6 | 6 |
[Service] |
| 7 |
-ExecStart=/usr/bin/docker-containerd --listen /run/containerd.sock --runtime /usr/bin/docker-runc |
|
| 7 |
+ExecStart=/usr/bin/docker-containerd --listen unix:///run/containerd.sock --runtime /usr/bin/docker-runc --shim /usr/bin/docker-containerd-shim |
|
| 8 | 8 |
LimitNOFILE=1048576 |
| 9 | 9 |
LimitNPROC=1048576 |
| 10 | 10 |
LimitCORE=infinity |
| ... | ... |
@@ -1,16 +1,17 @@ |
| 1 |
-Summary: Docker |
|
| 2 |
-Name: docker |
|
| 3 |
-Version: 1.11.2 |
|
| 4 |
-Release: 1%{?dist}
|
|
| 5 |
-License: ASL 2.0 |
|
| 6 |
-URL: http://docs.docker.com |
|
| 7 |
-Group: Applications/File |
|
| 8 |
-Vendor: VMware, Inc. |
|
| 1 |
+Summary: Docker |
|
| 2 |
+Name: docker |
|
| 3 |
+Version: 1.12.1 |
|
| 4 |
+Release: 1%{?dist}
|
|
| 5 |
+License: ASL 2.0 |
|
| 6 |
+URL: http://docs.docker.com |
|
| 7 |
+Group: Applications/File |
|
| 8 |
+Vendor: VMware, Inc. |
|
| 9 | 9 |
Distribution: Photon |
| 10 |
-Source0: https://get.docker.com/builds/Linux/x86_64/%{name}-%{version}.tgz
|
|
| 11 |
-%define sha1 docker=1bfd065784e0f422c000d86da4feda87cd63ced8 |
|
| 12 |
-Source1: docker.service |
|
| 13 |
-Source2: docker-containerd.service |
|
| 10 |
+Source0: https://get.docker.com/builds/Linux/x86_64/%{name}-%{version}.tgz
|
|
| 11 |
+%define sha1 docker=9e51f3432a8ab68784ba92c4b6fbe58f59b0fb70 |
|
| 12 |
+Source1: docker.service |
|
| 13 |
+Source2: docker-containerd.service |
|
| 14 |
+Source3: docker-completion.bash |
|
| 14 | 15 |
BuildRequires: systemd |
| 15 | 16 |
Requires: systemd |
| 16 | 17 |
|
| ... | ... |
@@ -25,10 +26,13 @@ mv -v %{_builddir}/%{name}/* %{buildroot}/usr/bin/
|
| 25 | 25 |
install -vd %{buildroot}/lib/systemd/system
|
| 26 | 26 |
cp %{SOURCE1} %{buildroot}/lib/systemd/system/docker.service
|
| 27 | 27 |
cp %{SOURCE2} %{buildroot}/lib/systemd/system/docker-containerd.service
|
| 28 |
+install -vdm 755 %{buildroot}%{_datadir}/bash-completion/completions
|
|
| 29 |
+install -m 0644 %{SOURCE3} %{buildroot}%{_datadir}/bash-completion/completions/docker
|
|
| 28 | 30 |
|
| 29 | 31 |
%{_fixperms} %{buildroot}/*
|
| 30 | 32 |
%check |
| 31 | 33 |
make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}
|
| 34 |
+ |
|
| 32 | 35 |
%preun |
| 33 | 36 |
%systemd_preun docker.service |
| 34 | 37 |
%systemd_preun docker-containerd.service |
| ... | ... |
@@ -49,8 +53,15 @@ rm -rf %{buildroot}/*
|
| 49 | 49 |
%{_bindir}
|
| 50 | 50 |
/lib/systemd/system/docker.service |
| 51 | 51 |
/lib/systemd/system/docker-containerd.service |
| 52 |
+%{_datadir}/bash-completion/completions/docker
|
|
| 52 | 53 |
|
| 53 | 54 |
%changelog |
| 55 |
+* Wed Sep 21 2016 Xiaolin Li <xiaolinl@vmware.com> 1.12.1-1 |
|
| 56 |
+- Upgraded to version 1.12.1 |
|
| 57 |
+* Mon Aug 22 2016 Alexey Makhalov <amakhalov@vmware.com> 1.12.0-2 |
|
| 58 |
+- Added bash completion file |
|
| 59 |
+* Tue Aug 09 2016 Anish Swaminathan <anishs@vmware.com> 1.12.0-1 |
|
| 60 |
+- Upgraded to version 1.12.0 |
|
| 54 | 61 |
* Tue Jun 28 2016 Anish Swaminathan <anishs@vmware.com> 1.11.2-1 |
| 55 | 62 |
- Upgraded to version 1.11.2 |
| 56 | 63 |
* Thu May 26 2016 Divya Thaluru <dthaluru@vmware.com> 1.11.0-6 |