X Tutup
Skip to content

Commit 989db9b

Browse files
keszybzbluca
authored andcommitted
shell-completion: add journalctl --facility
Fixes systemd#21484.
1 parent 91ee7c5 commit 989db9b

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

shell-completion/bash/journalctl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ __get_machines() {
3232
}
3333

3434
__syslog_priorities=(emerg alert crit err warning notice info debug)
35+
__syslog_facilities=(kern user mail daemon auth syslog lpr news uucp cron authpriv ftp local0 local1 local2 local3 local4 local5 local6 local7)
3536

3637
_journalctl() {
3738
local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
@@ -44,7 +45,7 @@ _journalctl() {
4445
--show-cursor --dmesg -k --pager-end -e -r --reverse
4546
--utc -x --catalog --no-full --force --dump-catalog
4647
--flush --rotate --sync --no-hostname -N --fields'
47-
[ARG]='-b --boot -D --directory --file -F --field -t --identifier
48+
[ARG]='-b --boot -D --directory --file -F --field -t --identifier --facility
4849
-M --machine -o --output -u --unit --user-unit -p --priority
4950
--root --case-sensitive'
5051
[ARGUNKNOWN]='-c --cursor --interval -n --lines -S --since -U --until
@@ -81,6 +82,9 @@ _journalctl() {
8182
--machine|-M)
8283
comps=$( __get_machines )
8384
;;
85+
--facility)
86+
comps=${__syslog_facilities[*]}
87+
;;
8488
--priority|-p)
8589
comps=${__syslog_priorities[*]}
8690
compopt -o nosort

shell-completion/zsh/_journalctl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ _journalctl_boots() {
5656
"bootid:boot ids:compadd -a _bootid"
5757
}
5858

59+
(( $+functions[_journalctl_facilities] )) ||
60+
_journalctl_facilities() {
61+
local -a _journalctl_facilities
62+
_journalctl_facilities=(kern user mail daemon auth syslog lpr news uucp cron authpriv ftp local0 local1 local2 local3 local4 local5 local6 local7)
63+
_describe 'possible values' _journalctl_facilities
64+
}
65+
5966
# Build arguments for "journalctl" to be used in completion.
6067
# Use both --user and --system modes, they are not exclusive.
6168
local -a _modes; _modes=(--user --system)
@@ -103,7 +110,8 @@ _arguments -s \
103110
{-u+,--unit=}'[Show data only from the specified unit]:units:_journalctl_field_values _SYSTEMD_UNIT' \
104111
'--user-unit=[Show data only from the specified user session unit]:units:_journalctl_field_values USER_UNIT' \
105112
{-p+,--priority=}'[Show only messages within the specified priority range]:priority:_journalctl_field_values PRIORITY' \
106-
{-t+,--identifier=}'[Show only messages with the specified syslog identifier]:identifier:_journalctl_field_values SYSLOG_IDENTIFIER' \
113+
'--facility=[Filter messages by facility]:facility:_journalctl_facilities' \
114+
{-t+,--identifier=}'[Filter messages by syslog identifier]:identifier:_journalctl_field_values SYSLOG_IDENTIFIER' \
107115
{-c+,--cursor=}'[Start showing entries from the specified cursor]:cursors:_journalctl_field_values __CURSORS' \
108116
'--cursor-file=[Show entries using cursor store in file]:file:_files' \
109117
'--after-cursor=[Start showing entries from after the specified cursor]:cursors:_journalctl_field_values __CURSORS' \

0 commit comments

Comments
 (0)
X Tutup