1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-09 12:58:26 +03:00

Merge pull request #3942 from blueyed/zsh-respect-user-more

zsh completion: handle --user mode when filtering by state and in journalctl commands
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2016-08-11 15:39:15 -04:00 committed by GitHub
commit 9c5077fed4
2 changed files with 4 additions and 2 deletions

View File

@ -23,7 +23,7 @@ _list_fields() {
_journal_none() {
local -a _commands _files _jrnl_none
# Setting use-cache will slow this down considerably
_commands=( ${"$(_call_program commands "$service" -F _EXE 2>/dev/null)"} )
_commands=( ${"$(_call_program commands "$service $_sys_service_mgr -F _EXE" 2>/dev/null)"} )
_jrnl_none='yes'
_alternative : \
'files:/dev files:_files -W /dev -P /dev/' \
@ -51,6 +51,8 @@ _journal_boots() {
"bootid:boot ids:compadd -a _bootid"
}
local -a _modes; _modes=("--user" "--system")
local _sys_service_mgr=${${words:*_modes}[(R)(${(j.|.)_modes})]:---system}
_arguments -s \
{-h,--help}'[Show this help]' \
'--version[Show package version]' \

View File

@ -126,7 +126,7 @@ _filter_units_by_property() {
local property=$1 value=$2 ; shift ; shift
local -a units ; units=($*)
local props
for props in ${(ps:\n\n:)"$(_call_program units "$service show --no-pager --property="Id,$property" -- ${units} 2>/dev/null")"}; do
for props in ${(ps:\n\n:)"$(_call_program units "$service $_sys_service_mgr show --no-pager --property="Id,$property" -- ${units} 2>/dev/null")"}; do
props=(${(f)props})
if [[ "${props[2]}" = "$property=$value" ]]; then
echo -E - " ${props[1]#Id=}"