| 1 |
_gpaste-client() |
| 2 |
{ |
| 3 |
local cur |
| 4 |
|
| 5 |
cur="${COMP_WORDS[${COMP_CWORD}]}" |
| 6 |
COMPREPLY=() |
| 7 |
|
| 8 |
if [[ ${COMP_CWORD} == 1 ]]; then |
| 9 |
|
| 10 |
local opts |
| 11 |
|
| 12 |
opts="about add add-password backup-history daemon daemon-reexec daemon-version delete delete-history --decoration -d delete-password empty file get get-history help --help -h history history-size list-histories merge --oneline -o preferences quit remove --raw -r rename-password replace --reverse -e select --separator -s set set-password settings show-history start stop switch-history upload ui version --version -v --zero -z" |
| 13 |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur} ) ) |
| 14 |
|
| 15 |
elif [[ ${COMP_CWORD} == 2 ]]; then |
| 16 |
|
| 17 |
local action |
| 18 |
|
| 19 |
action="${COMP_WORDS[1]}" |
| 20 |
case "${action}" in |
| 21 |
file|f) |
| 22 |
COMPREPLY=( $(compgen -f ) ) |
| 23 |
;; |
| 24 |
get|g) |
| 25 |
COMPREPLY=( compgen -W "--raw -r" -- ${cur} ) |
| 26 |
;; |
| 27 |
history|h) |
| 28 |
COMPREPLY=( compgen -W "--oneline -o --raw -r --reverse -e --zero -z" -- ${cur} ) |
| 29 |
;; |
| 30 |
esac |
| 31 |
|
| 32 |
fi |
| 33 |
} |
| 34 |
|
| 35 |
complete -F _gpaste-client gpaste-client |