| 1 |
_logger_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'|'--journald') |
| 9 |
local IFS=$'\n' |
| 10 |
compopt -o filenames |
| 11 |
COMPREPLY=( $(compgen -f -- $cur) ) |
| 12 |
return 0 |
| 13 |
;; |
| 14 |
'-n'|'--server') |
| 15 |
COMPREPLY=( $(compgen -A hostname -- $cur) ) |
| 16 |
return 0 |
| 17 |
;; |
| 18 |
'-P'|'--port') |
| 19 |
COMPREPLY=( $(compgen -W "$(command awk '$1 ~ /^syslog$/ {split($2, a, "/"); print a[1]}' /etc/services)" -- $cur) ) |
| 20 |
return 0 |
| 21 |
;; |
| 22 |
'-p'|'--priority') |
| 23 |
COMPREPLY=( $(compgen -W "{auth,authpriv,cron,daemon,ftp,lpr,mail,news,security}.{alert,crit,debug,emerg,err,error}" -- $cur) ) |
| 24 |
return 0 |
| 25 |
;; |
| 26 |
'-t'|'--tag') |
| 27 |
COMPREPLY=( $(compgen -W "tag" -- $cur) ) |
| 28 |
return 0 |
| 29 |
;; |
| 30 |
'-u'|'--socket') |
| 31 |
COMPREPLY=( $(compgen -W "$(command awk '$NF ~ /^\// {print $NF}' /proc/net/unix)" -- $cur) ) |
| 32 |
return 0 |
| 33 |
;; |
| 34 |
'--socket-errors') |
| 35 |
COMPREPLY=( $(compgen -W "on off auto" -- $cur) ) |
| 36 |
return 0 |
| 37 |
;; |
| 38 |
'--msgid') |
| 39 |
COMPREPLY=( $(compgen -W "msgid" -- $cur) ) |
| 40 |
return 0 |
| 41 |
;; |
| 42 |
'--sd-id') |
| 43 |
COMPREPLY=( $(compgen -W "timeQuality origin meta" -- $cur) ) |
| 44 |
return 0 |
| 45 |
;; |
| 46 |
'-h'|'--help'|'-V'|'--version') |
| 47 |
return 0 |
| 48 |
;; |
| 49 |
esac |
| 50 |
case $cur in |
| 51 |
-*) |
| 52 |
OPTS=" |
| 53 |
--file |
| 54 |
--help |
| 55 |
--id |
| 56 |
--journald |
| 57 |
--msgid |
| 58 |
--no-act |
| 59 |
--octet-count |
| 60 |
--port |
| 61 |
--prio-prefix |
| 62 |
--priority |
| 63 |
--rfc3164 |
| 64 |
--rfc5424 |
| 65 |
--sd-id |
| 66 |
--sd-param |
| 67 |
--server |
| 68 |
--size |
| 69 |
--skip-empty |
| 70 |
--socket |
| 71 |
--socket-errors |
| 72 |
--stderr |
| 73 |
--tag |
| 74 |
--tcp |
| 75 |
--udp |
| 76 |
--version |
| 77 |
" |
| 78 |
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) |
| 79 |
return 0 |
| 80 |
;; |
| 81 |
esac |
| 82 |
return 0 |
| 83 |
} |
| 84 |
complete -F _logger_module logger |