]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
zsh: _journalctl: handle --user in _journal_none 3942/head
authorDaniel Hahler <git@thequod.de>
Thu, 11 Aug 2016 16:52:13 +0000 (18:52 +0200)
committerDaniel Hahler <git@thequod.de>
Thu, 11 Aug 2016 16:52:13 +0000 (18:52 +0200)
This uses the same mechanism from _systemctl to inject `--user` into the
`journalctrl -F _EXE` call to list executables.
Before this patch the "commands" section would list executables from
system units always.

shell-completion/zsh/_journalctl

index 2bee23b6d3aa33c1c61f507e04acfaec442079cc..2271f7fa9c5d4a09026753321b1ffea4828a94b6 100644 (file)
@@ -23,7 +23,7 @@ _list_fields() {
 _journal_none() {
     local -a _commands _files _jrnl_none
     # Setting use-cache will slow this down considerably
-    _commands=( ${"$(_call_program commands "$service" -F _EXE 2>/dev/null)"} )
+    _commands=( ${"$(_call_program commands "$service $_sys_service_mgr -F _EXE" 2>/dev/null)"} )
     _jrnl_none='yes'
     _alternative : \
         'files:/dev files:_files -W /dev -P /dev/' \
@@ -51,6 +51,8 @@ _journal_boots() {
     "bootid:boot ids:compadd -a _bootid"
 }
 
+local -a _modes; _modes=("--user" "--system")
+local _sys_service_mgr=${${words:*_modes}[(R)(${(j.|.)_modes})]:---system}
 _arguments -s \
     {-h,--help}'[Show this help]' \
     '--version[Show package version]' \