Skip to content
This repository was archived by the owner on Jan 25, 2019. It is now read-only.

Commit ea63225

Browse files
committed
Fix bash-completion
1 parent 7d78017 commit ea63225

File tree

1 file changed

+10
-24
lines changed

1 file changed

+10
-24
lines changed

bash-completion.sh

+10-24
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,23 @@
1-
# bash completions for the command `ds domains-add`
2-
_ds_domains-rm() {
3-
local cur=${COMP_WORDS[COMP_CWORD]} ## $1
4-
local domains=$(cat containers.txt | cut -d: -f2)
5-
COMPREPLY=( $(compgen -W "$domains" -- $cur) )
6-
}
7-
81
# bash completions for the command `ds domains-add`
92
_ds_domains-add() {
10-
COMPREPLY=() # Array variable storing the possible completions.
11-
local cur=${COMP_WORDS[COMP_CWORD]} ## $1
12-
local prev=${COMP_WORDS[COMP_CWORD-1]} ## $2
3+
local containers=$(docker ps -a --format "{{.Names}}")
4+
COMPREPLY=( $(compgen -W "$containers" -- $1) )
5+
}
136

14-
if [[ $COMP_CWORD -eq 2 ]]; then
15-
local containers=$(docker ps -a --format "{{.Names}}")
16-
COMPREPLY=( $(compgen -W "$containers" -- $cur) )
17-
fi
7+
# bash completions for the command `ds domains-rm`
8+
_ds_domains-rm() {
9+
local domains=$(cat $(_ds_container_dir)/containers.txt | cut -d: -f2)
10+
COMPREPLY=( $(compgen -W "$domains" -- $1) )
1811
}
1912

2013
# bash completions for the command `ds get-ssl-cert`
2114
_ds_get-ssl-cert() {
22-
COMPREPLY=() # Array variable storing the possible completions.
23-
local cur=${COMP_WORDS[COMP_CWORD]} ## $1
24-
local prev=${COMP_WORDS[COMP_CWORD-1]} ## $2
25-
26-
if [[ $COMP_CWORD -gt 2 ]]; then
27-
local domains=$(cat containers.txt | cut -d: -f2)
28-
COMPREPLY=( $(compgen -W "$domains" -- $cur) )
29-
fi
15+
local domains=$(cat $(_ds_container_dir)/containers.txt | cut -d: -f2)
16+
COMPREPLY=( $(compgen -W "$domains" -- $1) )
3017
}
3118

3219
# bash completions for the command `ds sshtunnel-rm`
3320
_ds_sshtunnel-rm() {
34-
local cur=${COMP_WORDS[COMP_CWORD]} ## $1
3521
local domains=$(ls sshtunnel-keys/*.key | sed -e 's#sshtunnel-keys/##g' -e 's/.key//g')
36-
COMPREPLY=( $(compgen -W "$domains" -- $cur) )
22+
COMPREPLY=( $(compgen -W "$domains" -- $1) )
3723
}

0 commit comments

Comments
 (0)