Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[19.03 backport] backport bash completion scripts #1876

Merged
merged 5 commits into from
May 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 15 additions & 31 deletions contrib/completion/bash/docker
Original file line number Diff line number Diff line change
Expand Up @@ -2112,8 +2112,8 @@ _docker_container_run_and_create() {
return
;;
--security-opt)
COMPREPLY=( $( compgen -W "apparmor= label= no-new-privileges seccomp=" -- "$cur") )
if [ "${COMPREPLY[*]}" != "no-new-privileges" ] ; then
COMPREPLY=( $( compgen -W "apparmor= label= no-new-privileges seccomp= systempaths=unconfined" -- "$cur") )
if [[ ${COMPREPLY[*]} = *= ]] ; then
__docker_nospace
fi
return
Expand Down Expand Up @@ -2342,11 +2342,15 @@ _docker_context_create() {
--description|--docker|--kubernetes)
return
;;
--from)
__docker_complete_contexts
return
;;
esac

case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--default-stack-orchestrator --description --docker --help --kubernetes" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--default-stack-orchestrator --description --docker --from --help --kubernetes" -- "$cur" ) )
;;
esac
}
Expand Down Expand Up @@ -2617,36 +2621,15 @@ _docker_daemon() {
return
;;
--storage-driver|-s)
COMPREPLY=( $( compgen -W "aufs btrfs devicemapper overlay overlay2 vfs zfs" -- "$(echo "$cur" | tr '[:upper:]' '[:lower:]')" ) )
COMPREPLY=( $( compgen -W "aufs btrfs overlay2 vfs zfs" -- "$(echo "$cur" | tr '[:upper:]' '[:lower:]')" ) )
return
;;
--storage-opt)
local btrfs_options="btrfs.min_space"
local devicemapper_options="
dm.basesize
dm.blkdiscard
dm.blocksize
dm.directlvm_device
dm.fs
dm.libdm_log_level
dm.loopdatasize
dm.loopmetadatasize
dm.min_free_space
dm.mkfsarg
dm.mountopt
dm.override_udev_sync_check
dm.thinpooldev
dm.thinp_autoextend_percent
dm.thinp_autoextend_threshold
dm.thinp_metapercent
dm.thinp_percent
dm.use_deferred_deletion
dm.use_deferred_removal
"
local overlay2_options="overlay2.size"
local zfs_options="zfs.fsname"

local all_options="$btrfs_options $devicemapper_options $overlay2_options $zfs_options"
local all_options="$btrfs_options $overlay2_options $zfs_options"

case $(__docker_value_of_option '--storage-driver|-s') in
'')
Expand All @@ -2655,9 +2638,6 @@ _docker_daemon() {
btrfs)
COMPREPLY=( $( compgen -W "$btrfs_options" -S = -- "$cur" ) )
;;
devicemapper)
COMPREPLY=( $( compgen -W "$devicemapper_options" -S = -- "$cur" ) )
;;
overlay2)
COMPREPLY=( $( compgen -W "$overlay2_options" -S = -- "$cur" ) )
;;
Expand Down Expand Up @@ -5178,12 +5158,16 @@ _docker_system_events() {
__docker_complete_networks --cur "${cur##*=}"
return
;;
node)
__docker_complete_nodes --cur "${cur##*=}"
return
;;
scope)
COMPREPLY=( $( compgen -W "local swarm" -- "${cur##*=}" ) )
return
;;
type)
COMPREPLY=( $( compgen -W "config container daemon image network plugin secret service volume" -- "${cur##*=}" ) )
COMPREPLY=( $( compgen -W "config container daemon image network node plugin secret service volume" -- "${cur##*=}" ) )
return
;;
volume)
Expand All @@ -5194,7 +5178,7 @@ _docker_system_events() {

case "$prev" in
--filter|-f)
COMPREPLY=( $( compgen -S = -W "container daemon event image label network scope type volume" -- "$cur" ) )
COMPREPLY=( $( compgen -S = -W "container daemon event image label network node scope type volume" -- "$cur" ) )
__docker_nospace
return
;;
Expand Down