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-...
This commit is contained in:
Douglas Christman 2016-01-25 18:10:31 -05:00
parent f49ce89edf
commit 655fd9d71f

View File

@ -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
}