summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Christman <DouglasChristman@gmail.com>2016-01-25 18:10:31 -0500
committerDouglas Christman <DouglasChristman@gmail.com>2016-01-25 18:10:31 -0500
commit655fd9d71f22dc3efe4f4fae2da633c93cb67292 (patch)
treed6d5303fa9e7a6cd4a0d646ab4479800b3265fba
parentf49ce89edf37a20abed923782dd8176d6c0e7166 (diff)
zsh-completion: Escape results for `journalctl --unit`
Escape colons and backslashes in unit names. This gives correct completions for units with names like systemd-backlight@backlight:acpi_video0.service and systemd-fsck@dev-disk-by\x2duuid-...
-rw-r--r--shell-completion/zsh/_journalctl5
1 files changed, 4 insertions, 1 deletions
diff --git a/shell-completion/zsh/_journalctl b/shell-completion/zsh/_journalctl
index b50f0cafc9..2bee23b6d3 100644
--- a/shell-completion/zsh/_journalctl
+++ b/shell-completion/zsh/_journalctl
@@ -34,7 +34,10 @@ _journal_none() {
_journal_fields() {
local -a _fields cmd
cmd=("journalctl" "-F ${@[-1]}" "2>/dev/null" )
- _fields=( ${(f)"$(_call_program fields $cmd[@])"} )
+ _fields=$(_call_program fields $cmd[@])
+ _fields=${_fields//'\'/'\\'}
+ _fields=${_fields//':'/'\:'}
+ _fields=( ${(f)_fields} )
typeset -U _fields
_describe 'possible values' _fields
}