From e1e89ad4f8ae82123efd51e35c54ba47ef14e11f Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Tue, 26 Feb 2013 22:36:24 +0100 Subject: [PATCH] _logger: initial commit --- src/_logger | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/_logger diff --git a/src/_logger b/src/_logger new file mode 100644 index 0000000..2b25938 --- /dev/null +++ b/src/_logger @@ -0,0 +1,61 @@ +#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 "$@"