| 1 |
# caffeinate(1) completion -*- shell-script -*- |
| 2 |
# Adapted from bash-completion's ccache completion script |
| 3 |
# License: GPL-V2+ |
| 4 |
|
| 5 |
_caffeinate() |
| 6 |
{ |
| 7 |
local cur prev words cword |
| 8 |
_init_completion || return |
| 9 |
|
| 10 |
local i |
| 11 |
for (( i=1; i <= COMP_CWORD; i++ )); do |
| 12 |
if [[ ${COMP_WORDS[i]} != -* ]]; then |
| 13 |
_command_offset $i |
| 14 |
return |
| 15 |
fi |
| 16 |
done |
| 17 |
|
| 18 |
case "$prev" in |
| 19 |
-h|--help|-V|--version) |
| 20 |
return |
| 21 |
;; |
| 22 |
esac |
| 23 |
|
| 24 |
if [[ "$cur" == -* ]]; then |
| 25 |
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) |
| 26 |
[[ $COMPREPLY == *= ]] && compopt -o nospace |
| 27 |
return |
| 28 |
fi |
| 29 |
} && |
| 30 |
complete -F _caffeinate caffeinate |
| 31 |
|
| 32 |
# ex: ts=4 sw=4 et filetype=sh |