#compdef logger # ------------------------------------------------------------------------------ # Description # ----------- # # Completion script for logger (from bsdutils). # # Last updated: 26.02.2013 # # ------------------------------------------------------------------------------ # Authors # ------- # # * Valodim ( https://github.com/Valodim ) # # ------------------------------------------------------------------------------ _logger_priority() { local expl if compset -P '*.'; then # hidden aliases.. not quite sure how this is supposed to work :\ # compadd -n panic warning error # just this one tag _wanted priority expl "Priority" \ compadd -- debug info notice warn err crit alert emerg return 0 fi _wanted facility expl "Facility" \ compadd -S '.' -- kern user mail daemon auth syslog lpr news \ uucp cron security ftp ntp logaudit logalert clock \ local0 local1 local2 local3 local4 local5 local6 local7 return 0 } _logger() { local curcontext="$curcontext" state line typeset -A opt_args _arguments -C -S -s \ {-d,--udp}'[use UDP (TCP is default)]' \ {-i,--id}'[log the process ID too]' \ {-f,--file}'[log the contents of this file]:Logfile:_files' \ '(-)'{-h,--help}'[display this help text and exit]' \ {-n,--server}'[write to this remote syslog server]:Server:_hosts' \ {-P,--port}'[use this UDP port]:UDP Port' \ {-p,--priority}'[mark given message with this priority]:Priority:_logger_priority' \ {-s,--stderr}'[output message to standard error as well]' \ {-t,--tag}'[mark every line with this tag]:Tag' \ {-u,--socket}'[write to this Unix socket]:Socket:_files -W *(=)' \ '(-)'{-V,--version}'[output version information and exit]' \ '*:Message:' && return 0 } _logger "$@"