forked from zsh-users/zsh-completions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_logger
61 lines (50 loc) · 1.93 KB
/
_logger
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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 "$@"