forked from sonick13/PerlProjects
-
Notifications
You must be signed in to change notification settings - Fork 0
/
completions
45 lines (41 loc) · 1.37 KB
/
completions
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
#!/usr/bin/env bash
#cito M:644 O:0 G:0 T:/usr/share/bash-completion/completions/wcdl
#------------------------------------------------------------------------------
# Project Name - PerlProjects/source/wcdl/completions
# Started On - Mon 29 Jan 18:47:58 GMT 2018
# Last Change - Sat 15 Feb 00:27:28 GMT 2020
# Author E-Mail - [email protected]
# Author GitHub - https://github.com/terminalforlife
#------------------------------------------------------------------------------
# This is the bash completion script for wcdl.
#------------------------------------------------------------------------------
_wcdl(){
GetArgs(){
while read; do
if [[ $REPLY =~ ^[[:space:]]{2} ]]; then
Option=${REPLY%% - *}
for Arg in ${Option//,/}; {
printf '%s ' "${Arg##[^-]*}"
}
fi
done <<< "$(wcdl -h)"
unset Option Arg
}
GetCats(){
while read -a X; do
if [ "${X[0]}" -a "${X[0]}" != "CATEGORY" ]; then
printf "%s " "${X[0]}"
fi
done <<< "$(wcdl --colorless --show-categories)"
}
if [[ $3 =~ ^(--resolution|-r)$ ]]; then
COMPREPLY=($(compgen -W "$(wcdl --show-resolutions)" -- "$2"))
elif [[ "$2" == -* ]]; then
COMPREPLY=($(compgen -W "$(GetArgs)" -- "$2"))
elif [[ $3 =~ ^(--dest|-D)$ ]]; then
COMPREPLY=($(compgen -o default -- "$2"))
else
COMPREPLY=($(compgen -W "$(GetCats)" -- "$2"))
fi
}
complete -F _wcdl wcdl