[systemd-devel] [PATCH WIP] shell-completion: Change zsh boot id completion

William Giokas 1007380 at gmail.com
Fri Feb 21 05:48:05 PST 2014


Previously we put the boot offset and boot ID into the completion, now
we use something similar to the coredumpctl completion, but only with
the boot offsets.
---

This is just something I'm working on, but would like some input. I'm fine
with it not having the boot ID's output, but that may be unacceptable.

 shell-completion/zsh/_journalctl | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/shell-completion/zsh/_journalctl b/shell-completion/zsh/_journalctl
index 0d16a26..4467249 100644
--- a/shell-completion/zsh/_journalctl
+++ b/shell-completion/zsh/_journalctl
@@ -40,12 +40,9 @@ _journal_fields() {
 }
 
 _journal_boots() {
-  local -a _bootid _previousboots
-  _bootid=( ${(fao)"$(_call_program bootid "$service -F _BOOT_ID")"}  )
-  _previousboots=( -{1..${#_bootid}} )
-  _alternative : \
-    "offsets:boot offsets:(${_previousboots[1,-2]})" \
-    "bootid:boot ids:(${_bootid[@]})"
+  local -a _bootoff
+  _bootoff=( "${(foa)$(journalctl --list-boots | awk 'BEGIN{OFS=":"} {print $1,$0}' 2>/dev/null)}" )
+  _describe -t pids 'boot offsets' _bootoff
 }
 
 _arguments -s \
-- 
1.9.0



More information about the systemd-devel mailing list