-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbash_completion
55 lines (48 loc) · 1.23 KB
/
bash_completion
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
### Spawn completion definitions ###
_spawn_complete_docker_images() {
local format='{{.Repository}}:{{.Tag}}'
if [ "$(command -v docker)" ]; then
docker image ls --no-trunc --format "$format" | grep -v '<none>$'
fi
}
_spawn_complete() {
local cur prev
_get_comp_words_by_ref -n : cur prev
local options=(
-h -n
--help
--dry-run
--using-docker
--using-podman
--name
--as-root
--user
--bind
--bind-home
--with-gpu
--with-x11
--with-pulseaudio
--with-keepassxc
--with-secret
--with-certs
)
case $prev in
--name|--user|--with-secret|--with-certs)
COMPREPLY=()
return ;;
--bind|--bind-home)
COMPREPLY=($(compgen -o dirnames -- "$cur"))
return ;;
esac
case $cur in
-*)
COMPREPLY=($(compgen -W "${options[*]}" -- "$cur"))
return ;;
*)
COMPREPLY=($(compgen -W "$(_spawn_complete_docker_images)" -- "$cur"))
__ltrim_colon_completions "$cur"
return ;;
esac
}
complete -F _spawn_complete spawn
### End of Spawn completion definitions ###