Repository navigation
Expand file tree
/
Copy pathcompletely.bash
More file actions
127 lines (95 loc) · 5.43 KB
/
Copy pathcompletely.bash
File metadata and controls
127 lines (95 loc) · 5.43 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# sshm0 completion -*- shell-script -*-
# This bash completions script was generated by
# completely (https://github.com/dannyben/completely)
# Modifying it manually is not recommended
_sshm0_completions_filter() {
local words="$1"
local cur=${COMP_WORDS[COMP_CWORD]}
local result=()
if [[ "${cur:0:1}" == "-" ]]; then
echo "$words"
else
for word in $words; do
[[ "${word:0:1}" != "-" ]] && result+=("$word")
done
echo "${result[*]}"
fi
}
_sshm0_completions() {
local cur=${COMP_WORDS[COMP_CWORD]}
local compwords=("${COMP_WORDS[@]:1:$COMP_CWORD-1}")
local compline="${compwords[*]}"
case "$compline" in
'edit'*'--key')
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "$(dir="$HOME/.ssh"; [ -d "$dir" ] && /usr/bin/ls "$dir" || true)")" -- "$cur" )
;;
'add'*'--key')
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "$(dir="$HOME/.ssh"; [ -d "$dir" ] && /usr/bin/ls "$dir" || true)")" -- "$cur" )
;;
'list'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "--tag -t --filter -f --long -l --recent -r --group -g --tree --no-tree")" -- "$cur" )
;;
'connect'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "$(dir="${SSHM0_CONFIG_DIR:-$HOME/.config/sshm0}/servers"; [ -d "$dir" ] && /usr/bin/ls "$dir" || true) --cd --exec-before")" -- "$cur" )
;;
'remove'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "$(dir="${SSHM0_CONFIG_DIR:-$HOME/.config/sshm0}/servers"; [ -d "$dir" ] && /usr/bin/ls "$dir" || true) --yes --no-yes -y")" -- "$cur" )
;;
'edit'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "$(dir="${SSHM0_CONFIG_DIR:-$HOME/.config/sshm0}/servers"; [ -d "$dir" ] && /usr/bin/ls "$dir" || true) --ip --user --password -p --key -i --auth --port --connect --no-connect -c --tag -t --group -g --proxy -J --timeout")" -- "$cur" )
;;
'add'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "--password --pass --pwd -p --key -i --auth -a --port -P --force --no-force -f --connect --no-connect -c --tag -t --group -g --proxy -J --timeout")" -- "$cur" )
;;
'cp'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -A file -- "$cur" )
;;
'plugin'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "--help")" -- "$cur" )
;;
'rename'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "$(dir="${SSHM0_CONFIG_DIR:-$HOME/.config/sshm0}/servers"; [ -d "$dir" ] && /usr/bin/ls "$dir" || true)")" -- "$cur" )
;;
'show'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "$(dir="${SSHM0_CONFIG_DIR:-$HOME/.config/sshm0}/servers"; [ -d "$dir" ] && /usr/bin/ls "$dir" || true)")" -- "$cur" )
;;
'export'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "--output -o --merge")" -- "$cur" )
;;
'import'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "--file -f --force --no-force --dry-run --no-dry-run --tag -t")" -- "$cur" )
;;
'ping'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "$(dir="${SSHM0_CONFIG_DIR:-$HOME/.config/sshm0}/servers"; [ -d "$dir" ] && /usr/bin/ls "$dir" || true)")" -- "$cur" )
;;
'rsync'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -A file -- "$cur" )
;;
'history'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "--count -n --server -s")" -- "$cur" )
;;
'config'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "list get set plugins")" -- "$cur" )
;;
'doctor'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "")" -- "$cur" )
;;
'backup'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "--output -o --restore --yes --no-yes -y")" -- "$cur" )
;;
'update'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "--check -c --force -f")" -- "$cur" )
;;
'exec'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "$(dir="${SSHM0_CONFIG_DIR:-$HOME/.config/sshm0}/servers"; [ -d "$dir" ] && /usr/bin/ls "$dir" || true) --tag -t --group -g --parallel --no-parallel -p --yes --no-yes -y --timeout")" -- "$cur" )
;;
'tags'*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "--long -l")" -- "$cur" )
;;
*)
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_sshm0_completions_filter "list add config connect cp edit export import plugin remove rename show ping rsync doctor tags history backup update exec --config-dir")" -- "$cur" )
;;
esac
} &&
complete -F _sshm0_completions sshm0
# ex: filetype=sh