| 1 |
_last_module() |
| 2 |
{ |
| 3 |
local cur prev OPTS |
| 4 |
COMPREPLY=() |
| 5 |
cur="${COMP_WORDS[COMP_CWORD]}" |
| 6 |
prev="${COMP_WORDS[COMP_CWORD-1]}" |
| 7 |
case $prev in |
| 8 |
'-f'|'--file') |
| 9 |
local IFS=$'\n' |
| 10 |
compopt -o filenames |
| 11 |
COMPREPLY=( $(compgen -f -- $cur) ) |
| 12 |
return 0 |
| 13 |
;; |
| 14 |
'-n'|'--limit') |
| 15 |
COMPREPLY=( $(compgen -W "number" -- $cur) ) |
| 16 |
return 0 |
| 17 |
;; |
| 18 |
'-s'|'--since'|'-t'|'--until'|'-p'|'--present') |
| 19 |
COMPREPLY=( $(compgen -W "number" -- $cur) ) |
| 20 |
return 0 |
| 21 |
;; |
| 22 |
'--time-format') |
| 23 |
COMPREPLY=( $(compgen -W "notime short full iso" -- $cur) ) |
| 24 |
return 0 |
| 25 |
;; |
| 26 |
esac |
| 27 |
case $cur in |
| 28 |
-*) |
| 29 |
OPTS=" |
| 30 |
--hostlast |
| 31 |
--dns |
| 32 |
--file |
| 33 |
--fulltimes |
| 34 |
--ip |
| 35 |
--limit |
| 36 |
--nohostname |
| 37 |
--since |
| 38 |
--until |
| 39 |
--tab-separated |
| 40 |
--present |
| 41 |
--fullnames |
| 42 |
--system |
| 43 |
--time-format |
| 44 |
--help |
| 45 |
--version |
| 46 |
" |
| 47 |
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) |
| 48 |
return 0 |
| 49 |
;; |
| 50 |
esac |
| 51 |
COMPREPLY=( $(compgen -u -- $cur) ) |
| 52 |
return 0 |
| 53 |
} |
| 54 |
complete -F _last_module last lastb |