chiark / gitweb /
journalctl: add --system/--user flags
[elogind.git] / shell-completion / systemd-zsh-completion.zsh
index a30fcf8c059b87f17bd266267cf973428a2fa767..68628917239899f2db18d6e4ab45fd871fb27647 100644 (file)
@@ -71,6 +71,8 @@ _ctls()
                 '--since=[Start showing entries newer or of the specified date]:YYYY-MM-DD HH\:MM\:SS' \
                 '--until=[Stop showing entries older or of the specified date]:YYYY-MM-DD HH\:MM\:SS' \
                 {-c,--cursor=}'[Start showing entries from specified cursor]:cursors:_journal_fields __CURSORS' \
+                '--system[Show system and kernel messages]' \
+                '--user[Show messages from user services]' \
                 {-b,--this-boot}'[Show data only from current boot]' \
                 {-u,--unit=}'[Show data only from the specified unit]:units:_journal_fields _SYSTEMD_UNIT' \
                 '--user-unit[Show data only from the specified user session unit]:units:_journal_fields _SYSTEMD_USER_UNIT' \
@@ -896,12 +898,13 @@ _systemd-coredumpctl_command(){
         _describe -t commands 'systemd-coredumpctl command' _systemd_coredumpctl_cmds
     else
         local curcontext="$curcontext"
-        local -a dumps
+        local -a _dumps
         cmd="${${_systemd_coredumpctl_cmds[(r)$words[1]:*]%%:*}}"
         if (( $#cmd  )); then
-            dumps=( "${(f)$(_call_program dumps "systemd-coredumpctl list 2>/dev/null")}" )
-            if [[ -n "$dumps" ]]; then
-                compadd "${dumps[@]}"
+                       # user can set zstyle ':completion:*:*:systemd-coredumpctl:*' sort no for coredumps to be ordered by date, otherwise they get ordered by pid
+                       _dumps=( "${(foa)$(systemd-coredumpctl list | awk 'BEGIN{OFS=":"} /^\s/ {sub(/[[ \t]+/, ""); print $5,$0}' 2>/dev/null)}" )
+            if [[ -n "$_dumps" ]]; then
+                _describe -t pids 'coredumps' _dumps
             else
                 _message "no coredumps"
             fi
@@ -971,7 +974,7 @@ _udevadm_monitor(){
         '--kernel[Print the kernel uevents.]' \
         '--udev[Print the udev event after the rule processing.]' \
         '--property[Also print the properties of the event.]' \
-        '--subsystem-match=[Filter events by subsystem[/devtype].]' \
+        '--subsystem-match=[Filter events by subsystem/\[devtype\].]' \
         '--tag-match=[Filter events by property.]' \
         '--help[Print help text.]'
 }