[systemd-devel] [PATCH v3] zsh_completion: Correctly display journal fields
William Giokas
1007380 at gmail.com
Wed Aug 14 11:29:58 PDT 2013
Show equals and field values when used with _journal_none, don't show
anything if we're not using _journal_none.
---
This was originally making the -F completion broken, the case statement
below fixes that.
foo at bar:~ % journalctl -F _C<tab>
>> possible fields
_CMDLINE _COMM
foo at bar:~ % journalctl -F _COMM<tab>
foo at bar:~ % journalctl -F _COMM<space>
foo at bar:~ % journalctl _COMM<tab>
foo at bar:~ % journalctl _COMM=<tab>
>> possible values
foo bar baz
shell-completion/zsh/_journalctl | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/shell-completion/zsh/_journalctl b/shell-completion/zsh/_journalctl
index 61983d5..212bfdb 100644
--- a/shell-completion/zsh/_journalctl
+++ b/shell-completion/zsh/_journalctl
@@ -19,13 +19,18 @@ _list_fields() {
_KERNEL_{DEVICE,SUBSYSTEM}
_UDEV_{SYSNAME,DEVNODE,DEVLINK}
__CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP)
- _describe 'possible fields' journal_fields
+ case $_jrnl_none in
+ yes) _values -s '=' 'possible fields' \
+ "${journal_fields[@]}:value:_journal_fields ${words[CURRENT]%%=*}" ;;
+ *) _describe 'possible fields' journal_fields ;;
+ esac
}
_journal_none() {
- local -a _commands _files
+ local -a _commands _files _jrnl_none
# Setting use-cache will slow this down considerably
_commands=( ${"$(_call_program commands "$service" -F _EXE 2>/dev/null)"} )
+ _jrnl_none='yes'
_alternative : \
'files:/dev files:_files -W /dev -P /dev/' \
"commands:commands:($_commands[@])" \
--
1.8.4.rc3.464.g80e72f1
More information about the systemd-devel
mailing list