[systemd-devel] [PATCH v2] zsh_completion: Correctly display journal fields

William Giokas 1007380 at gmail.com
Mon Aug 12 10:26:18 PDT 2013


---

Just a slightly edited version that functions MUCH nicer. Now, on top of
putting in the equals sign, when you type in:

  journalctl _EXE=<tab>

it automagically calles _journal_fields with _EXE as an argument. Same
with every other value you could put in there. Some examples:

wgiokas at wst420:~ % journalctl _BOOT_ID=<tab>
>> possible values
037a3189b60e4da3917b49f7b92fe1ae  75fc1f7abd0c46d98c8dc159d69ae33c
wgiokas at wst420:~ % journalctl _HOSTNAME=<tab>
>> possible values
bridge1    localhost  wst420     wst421


 shell-completion/zsh/_journalctl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/shell-completion/zsh/_journalctl b/shell-completion/zsh/_journalctl
index 61983d5..0e909fe 100644
--- a/shell-completion/zsh/_journalctl
+++ b/shell-completion/zsh/_journalctl
@@ -19,7 +19,8 @@ _list_fields() {
                     _KERNEL_{DEVICE,SUBSYSTEM}
                     _UDEV_{SYSNAME,DEVNODE,DEVLINK}
                     __CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP)
-    _describe 'possible fields' journal_fields
+    _values -s '=' 'possible fields' \
+      "${journal_fields[@]}:value:_journal_fields ${words[CURRENT]%%=*}"
 }
 
 _journal_none() {
-- 
1.8.4.rc2.458.gc9b7461



More information about the systemd-devel mailing list