mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-07-24 00:59:29 +03:00
shell-completion: use 4 space indentation too
The same as in other places, indentation levels were all over the place.
This commit is contained in:
@ -3,7 +3,6 @@
|
|||||||
#
|
#
|
||||||
# This file is part of systemd.
|
# This file is part of systemd.
|
||||||
#
|
#
|
||||||
#
|
|
||||||
# systemd is free software; you can redistribute it and/or modify it
|
# systemd is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by
|
# under the terms of the GNU Lesser General Public License as published by
|
||||||
# the Free Software Foundation; either version 2.1 of the License, or
|
# the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#
|
#
|
||||||
# This file is part of systemd.
|
# This file is part of systemd.
|
||||||
#
|
#
|
||||||
#
|
|
||||||
# systemd is free software; you can redistribute it and/or modify it
|
# systemd is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by
|
# under the terms of the GNU Lesser General Public License as published by
|
||||||
# the Free Software Foundation; either version 2.1 of the License, or
|
# the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
@ -25,9 +25,9 @@ __contains_word () {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
__locale_fields=( LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME \
|
__locale_fields=( LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME
|
||||||
LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER \
|
LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER
|
||||||
LC_NAME LC_ADDRESS LC_TELEPHONE \
|
LC_NAME LC_ADDRESS LC_TELEPHONE
|
||||||
LC_MEASUREMENT LC_IDENTIFICATION )
|
LC_MEASUREMENT LC_IDENTIFICATION )
|
||||||
# LC_ALL is omitted on purpose
|
# LC_ALL is omitted on purpose
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#
|
#
|
||||||
# This file is part of systemd.
|
# This file is part of systemd.
|
||||||
#
|
#
|
||||||
#
|
|
||||||
# systemd is free software; you can redistribute it and/or modify it
|
# systemd is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by
|
# under the terms of the GNU Lesser General Public License as published by
|
||||||
# the Free Software Foundation; either version 2.1 of the License, or
|
# the Free Software Foundation; either version 2.1 of the License, or
|
||||||
@ -43,8 +42,9 @@ _machinectl() {
|
|||||||
|
|
||||||
local -A VERBS=(
|
local -A VERBS=(
|
||||||
[STANDALONE]='list list-images clean pull-tar pull-raw list-transfers cancel-transfer import-fs'
|
[STANDALONE]='list list-images clean pull-tar pull-raw list-transfers cancel-transfer import-fs'
|
||||||
[MACHINES]='status show start stop login shell enable disable poweroff reboot terminate kill bind copy-to copy-from
|
[MACHINES]='status show start stop login shell enable disable poweroff reboot terminate kill bind
|
||||||
image-status show-image clone rename read-only remove set-limit export-tar export-raw'
|
copy-to copy-from image-status show-image clone rename read-only remove set-limit
|
||||||
|
export-tar export-raw'
|
||||||
[FILE]='import-tar import-raw'
|
[FILE]='import-tar import-raw'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#
|
#
|
||||||
# This file is part of systemd.
|
# This file is part of systemd.
|
||||||
#
|
#
|
||||||
#
|
|
||||||
# systemd is free software; you can redistribute it and/or modify it
|
# systemd is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by
|
# under the terms of the GNU Lesser General Public License as published by
|
||||||
# the Free Software Foundation; either version 2.1 of the License, or
|
# the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#
|
#
|
||||||
# This file is part of systemd.
|
# This file is part of systemd.
|
||||||
#
|
#
|
||||||
#
|
|
||||||
# systemd is free software; you can redistribute it and/or modify it
|
# systemd is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by
|
# under the terms of the GNU Lesser General Public License as published by
|
||||||
# the Free Software Foundation; either version 2.1 of the License, or
|
# the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#
|
#
|
||||||
# This file is part of systemd.
|
# This file is part of systemd.
|
||||||
#
|
#
|
||||||
#
|
|
||||||
# systemd is free software; you can redistribute it and/or modify it
|
# systemd is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by
|
# under the terms of the GNU Lesser General Public License as published by
|
||||||
# the Free Software Foundation; either version 2.1 of the License, or
|
# the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#
|
#
|
||||||
# This file is part of systemd.
|
# This file is part of systemd.
|
||||||
#
|
#
|
||||||
#
|
|
||||||
# systemd is free software; you can redistribute it and/or modify it
|
# systemd is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by
|
# under the terms of the GNU Lesser General Public License as published by
|
||||||
# the Free Software Foundation; either version 2.1 of the License, or
|
# the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#
|
#
|
||||||
# This file is part of systemd.
|
# This file is part of systemd.
|
||||||
#
|
#
|
||||||
#
|
|
||||||
# systemd is free software; you can redistribute it and/or modify it
|
# systemd is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by
|
# under the terms of the GNU Lesser General Public License as published by
|
||||||
# the Free Software Foundation; either version 2.1 of the License, or
|
# the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#
|
#
|
||||||
# This file is part of systemd.
|
# This file is part of systemd.
|
||||||
#
|
#
|
||||||
#
|
|
||||||
# systemd is free software; you can redistribute it and/or modify it
|
# systemd is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by
|
# under the terms of the GNU Lesser General Public License as published by
|
||||||
# the Free Software Foundation; either version 2.1 of the License, or
|
# the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#
|
#
|
||||||
# This file is part of systemd.
|
# This file is part of systemd.
|
||||||
#
|
#
|
||||||
#
|
|
||||||
# systemd is free software; you can redistribute it and/or modify it
|
# systemd is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by
|
# under the terms of the GNU Lesser General Public License as published by
|
||||||
# the Free Software Foundation; either version 2.1 of the License, or
|
# the Free Software Foundation; either version 2.1 of the License, or
|
||||||
@ -63,14 +62,16 @@ _systemd_nspawn() {
|
|||||||
local i verb comps
|
local i verb comps
|
||||||
|
|
||||||
local -A OPTS=(
|
local -A OPTS=(
|
||||||
[STANDALONE]='-h --help --version --private-network -b --boot --read-only -q --quiet --share-system --keep-unit -n --network-veth
|
[STANDALONE]='-h --help --version --private-network -b --boot --read-only -q --quiet --share-system
|
||||||
-j -x --ephemeral -a --as-pid2 --private-users-chown -U'
|
--keep-unit -n --network-veth -j -x --ephemeral -a --as-pid2 --private-users-chown -U'
|
||||||
[ARG]='-D --directory -u --user --uuid --capability --drop-capability --link-journal --bind --bind-ro -M --machine
|
[ARG]='-D --directory -u --user --uuid --capability --drop-capability --link-journal --bind --bind-ro
|
||||||
-S --slice -E --setenv -Z --selinux-context -L --selinux-apifs-context --register --network-interface --network-bridge
|
-M --machine -S --slice -E --setenv -Z --selinux-context -L --selinux-apifs-context
|
||||||
--personality -i --image --tmpfs --volatile --network-macvlan --kill-signal --template --notify-ready --root-hash
|
--register --network-interface --network-bridge --personality -i --image --tmpfs
|
||||||
--chdir --pivot-root --property --private-users --network-namespace-path --network-ipvlan --network-veth-extra
|
--volatile --network-macvlan --kill-signal --template --notify-ready --root-hash --chdir
|
||||||
--network-zone -p --port --system-call-filter --overlay --overlay-ro --settings
|
--pivot-root --property --private-users --network-namespace-path --network-ipvlan
|
||||||
--rlimit --hostname --no-new-privileges --oom-score-adjust --cpu-affinity --resolv-conf --timezone'
|
--network-veth-extra --network-zone -p --port --system-call-filter --overlay --overlay-ro
|
||||||
|
--settings --rlimit --hostname --no-new-privileges --oom-score-adjust --cpu-affinity
|
||||||
|
--resolv-conf --timezone'
|
||||||
)
|
)
|
||||||
|
|
||||||
_init_completion || return
|
_init_completion || return
|
||||||
|
@ -110,6 +110,7 @@ _udevadm() {
|
|||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'trigger')
|
'trigger')
|
||||||
if __contains_word "$prev" ${OPTS[TRIGGER_ARG]}; then
|
if __contains_word "$prev" ${OPTS[TRIGGER_ARG]}; then
|
||||||
case $prev in
|
case $prev in
|
||||||
@ -141,6 +142,7 @@ _udevadm() {
|
|||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'settle')
|
'settle')
|
||||||
if __contains_word "$prev" ${OPTS[SETTLE]}; then
|
if __contains_word "$prev" ${OPTS[SETTLE]}; then
|
||||||
case $prev in
|
case $prev in
|
||||||
@ -157,6 +159,7 @@ _udevadm() {
|
|||||||
|
|
||||||
comps="${OPTS[COMMON]} ${OPTS[SETTLE]}"
|
comps="${OPTS[COMMON]} ${OPTS[SETTLE]}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'control')
|
'control')
|
||||||
if __contains_word "$prev" ${OPTS[CONTROL_ARG]}; then
|
if __contains_word "$prev" ${OPTS[CONTROL_ARG]}; then
|
||||||
case $prev in
|
case $prev in
|
||||||
@ -173,6 +176,7 @@ _udevadm() {
|
|||||||
|
|
||||||
comps="${OPTS[COMMON]} ${OPTS[CONTROL_STANDALONE]} ${OPTS[CONTROL_ARG]}"
|
comps="${OPTS[COMMON]} ${OPTS[CONTROL_STANDALONE]} ${OPTS[CONTROL_ARG]}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'monitor')
|
'monitor')
|
||||||
if __contains_word "$prev" ${OPTS[MONITOR_ARG]}; then
|
if __contains_word "$prev" ${OPTS[MONITOR_ARG]}; then
|
||||||
case $prev in
|
case $prev in
|
||||||
@ -186,6 +190,7 @@ _udevadm() {
|
|||||||
|
|
||||||
comps="${OPTS[COMMON]} ${OPTS[MONITOR_STANDALONE]} ${OPTS[MONITOR_ARG]}"
|
comps="${OPTS[COMMON]} ${OPTS[MONITOR_STANDALONE]} ${OPTS[MONITOR_ARG]}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'test')
|
'test')
|
||||||
if __contains_word "$prev" ${OPTS[TEST]}; then
|
if __contains_word "$prev" ${OPTS[TEST]}; then
|
||||||
case $prev in
|
case $prev in
|
||||||
@ -207,6 +212,7 @@ _udevadm() {
|
|||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'test-builtin')
|
'test-builtin')
|
||||||
for ((i=0; i < COMP_CWORD; i++)); do
|
for ((i=0; i < COMP_CWORD; i++)); do
|
||||||
if __contains_word "${COMP_WORDS[i]}" "${builtins[@]}"; then
|
if __contains_word "${COMP_WORDS[i]}" "${builtins[@]}"; then
|
||||||
@ -224,6 +230,7 @@ _udevadm() {
|
|||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
comps=${VERBS[*]}
|
comps=${VERBS[*]}
|
||||||
;;
|
;;
|
||||||
|
@ -25,5 +25,3 @@ _arguments \
|
|||||||
'1::add or remove:(add remove)' \
|
'1::add or remove:(add remove)' \
|
||||||
'2::kernel versions:_kernel-install_kernels' \
|
'2::kernel versions:_kernel-install_kernels' \
|
||||||
'3::kernel images:_kernel-install_images'
|
'3::kernel images:_kernel-install_images'
|
||||||
|
|
||||||
#vim: set ft=zsh sw=4 ts=4 et
|
|
||||||
|
@ -31,8 +31,8 @@ _loginctl_all_seats() {
|
|||||||
local fun
|
local fun
|
||||||
# Completion functions for SESSIONS
|
# Completion functions for SESSIONS
|
||||||
for fun in session-status show-session activate lock-session unlock-session terminate-session kill-session ; do
|
for fun in session-status show-session activate lock-session unlock-session terminate-session kill-session ; do
|
||||||
(( $+functions[_loginctl_$fun] )) || _loginctl_$fun()
|
(( $+functions[_loginctl_$fun] )) ||
|
||||||
{
|
_loginctl_$fun() {
|
||||||
local -a _sys_all_sessions{,_descr}
|
local -a _sys_all_sessions{,_descr}
|
||||||
|
|
||||||
_loginctl_all_sessions
|
_loginctl_all_sessions
|
||||||
@ -47,13 +47,13 @@ for fun in session-status show-session activate lock-session unlock-session term
|
|||||||
local expl
|
local expl
|
||||||
_wanted systemd-sessions expl session compadd "$@" -a _sys_all_sessions
|
_wanted systemd-sessions expl session compadd "$@" -a _sys_all_sessions
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
done
|
done
|
||||||
|
|
||||||
# Completion functions for USERS
|
# Completion functions for USERS
|
||||||
for fun in user-status show-user enable-linger disable-linger terminate-user kill-user ; do
|
for fun in user-status show-user enable-linger disable-linger terminate-user kill-user ; do
|
||||||
(( $+functions[_loginctl_$fun] )) || _loginctl_$fun()
|
(( $+functions[_loginctl_$fun] )) ||
|
||||||
{
|
_loginctl_$fun() {
|
||||||
local -a _sys_all_users{,_descr}
|
local -a _sys_all_users{,_descr}
|
||||||
zstyle -a ":completion:${curcontext}:users" users _sys_all_users
|
zstyle -a ":completion:${curcontext}:users" users _sys_all_users
|
||||||
|
|
||||||
@ -73,12 +73,12 @@ for fun in user-status show-user enable-linger disable-linger terminate-user kil
|
|||||||
local expl
|
local expl
|
||||||
_wanted users expl user compadd "$@" -a _sys_all_users
|
_wanted users expl user compadd "$@" -a _sys_all_users
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
done
|
done
|
||||||
|
|
||||||
# Completion functions for SEATS
|
# Completion functions for SEATS
|
||||||
(( $+functions[_loginctl_seats] )) || _loginctl_seats()
|
(( $+functions[_loginctl_seats] )) ||
|
||||||
{
|
_loginctl_seats() {
|
||||||
local -a _sys_all_seats{,_descr}
|
local -a _sys_all_seats{,_descr}
|
||||||
|
|
||||||
_loginctl_all_seats
|
_loginctl_all_seats
|
||||||
@ -95,13 +95,13 @@ done
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
for fun in seat-status show-seat terminate-seat ; do
|
for fun in seat-status show-seat terminate-seat ; do
|
||||||
(( $+functions[_loginctl_$fun] )) || _loginctl_$fun()
|
(( $+functions[_loginctl_$fun] )) ||
|
||||||
{ _loginctl_seats }
|
_loginctl_$fun() { _loginctl_seats }
|
||||||
done
|
done
|
||||||
|
|
||||||
# Completion functions for ATTACH
|
# Completion functions for ATTACH
|
||||||
(( $+functions[_loginctl_attach] )) || _loginctl_attach()
|
(( $+functions[_loginctl_attach] )) ||
|
||||||
{
|
_loginctl_attach() {
|
||||||
_arguments -w -C -S -s \
|
_arguments -w -C -S -s \
|
||||||
':seat:_loginctl_seats' \
|
':seat:_loginctl_seats' \
|
||||||
'*:device:_files'
|
'*:device:_files'
|
||||||
@ -110,8 +110,8 @@ done
|
|||||||
# no loginctl completion for:
|
# no loginctl completion for:
|
||||||
# [STANDALONE]='list-sessions list-users list-seats flush-devices'
|
# [STANDALONE]='list-sessions list-users list-seats flush-devices'
|
||||||
|
|
||||||
(( $+functions[_loginctl_commands] )) || _loginctl_commands()
|
(( $+functions[_loginctl_commands] )) ||
|
||||||
{
|
_loginctl_commands() {
|
||||||
local -a _loginctl_cmds
|
local -a _loginctl_cmds
|
||||||
_loginctl_cmds=(
|
_loginctl_cmds=(
|
||||||
"list-sessions:List sessions"
|
"list-sessions:List sessions"
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
# SPDX-License-Identifier: LGPL-2.1+
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
|
|
||||||
(( $+functions[__machinectl_get_machines] )) ||
|
(( $+functions[__machinectl_get_machines] )) ||
|
||||||
__machinectl_get_machines () {
|
__machinectl_get_machines () {
|
||||||
machinectl --no-legend list-images | {while read -r a b; do echo $a; done;}
|
machinectl --no-legend list-images | {while read -r a b; do echo $a; done;}
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_machinectl_machines] )) ||
|
(( $+functions[_machinectl_machines] )) ||
|
||||||
_machinectl_machines() {
|
_machinectl_machines() {
|
||||||
local -a _machines
|
local -a _machines
|
||||||
_machines=("${(fo)$(__machinectl_get_machines)}")
|
_machines=("${(fo)$(__machinectl_get_machines)}")
|
||||||
typeset -U _machines
|
typeset -U _machines
|
||||||
@ -16,7 +16,7 @@ _machinectl_machines() {
|
|||||||
else
|
else
|
||||||
_message 'no machines'
|
_message 'no machines'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_machinectl_commands] )) || _machinectl_commands()
|
(( $+functions[_machinectl_commands] )) || _machinectl_commands()
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# SPDX-License-Identifier: LGPL-2.1+
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
|
|
||||||
(( $+functions[_networkctl_commands] )) ||
|
(( $+functions[_networkctl_commands] )) ||
|
||||||
_networkctl_commands(){
|
_networkctl_commands() {
|
||||||
local -a _networkctl_cmds
|
local -a _networkctl_cmds
|
||||||
_networkctl_cmds=(
|
_networkctl_cmds=(
|
||||||
'list:List existing links'
|
'list:List existing links'
|
||||||
@ -27,7 +27,7 @@ _networkctl_commands(){
|
|||||||
_message "no more options"
|
_message "no more options"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_arguments \
|
_arguments \
|
||||||
{-a,--all}'[Show all links with status]' \
|
{-a,--all}'[Show all links with status]' \
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
# SPDX-License-Identifier: LGPL-2.1+
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
|
|
||||||
(( $+functions[__sd_machines_get_machines] )) ||
|
(( $+functions[__sd_machines_get_machines] )) ||
|
||||||
__sd_machines_get_machines () {
|
__sd_machines_get_machines () {
|
||||||
machinectl --full --no-legend --no-pager list | {while read -r a b; do echo $a; done;};
|
machinectl --full --no-legend --no-pager list | {while read -r a b; do echo $a; done;};
|
||||||
}
|
}
|
||||||
|
|
||||||
local -a _machines
|
local -a _machines
|
||||||
_machines=("${(fo)$(__sd_machines_get_machines)}")
|
_machines=("${(fo)$(__sd_machines_get_machines)}")
|
||||||
|
@ -104,7 +104,7 @@ __systemctl()
|
|||||||
|
|
||||||
# Fills the unit list
|
# Fills the unit list
|
||||||
(( $+functions[_systemctl_all_units] )) ||
|
(( $+functions[_systemctl_all_units] )) ||
|
||||||
_systemctl_all_units()
|
_systemctl_all_units()
|
||||||
{
|
{
|
||||||
if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid SYS_ALL_UNITS$_sys_service_mgr ) ||
|
if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid SYS_ALL_UNITS$_sys_service_mgr ) ||
|
||||||
! _retrieve_cache SYS_ALL_UNITS$_sys_service_mgr;
|
! _retrieve_cache SYS_ALL_UNITS$_sys_service_mgr;
|
||||||
@ -116,7 +116,7 @@ _systemctl_all_units()
|
|||||||
|
|
||||||
# Fills the unit list including all file units
|
# Fills the unit list including all file units
|
||||||
(( $+functions[_systemctl_really_all_units] )) ||
|
(( $+functions[_systemctl_really_all_units] )) ||
|
||||||
_systemctl_really_all_units()
|
_systemctl_really_all_units()
|
||||||
{
|
{
|
||||||
local -a all_unit_files;
|
local -a all_unit_files;
|
||||||
local -a really_all_units;
|
local -a really_all_units;
|
||||||
@ -132,49 +132,49 @@ _systemctl_really_all_units()
|
|||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_filter_units_by_property] )) ||
|
(( $+functions[_filter_units_by_property] )) ||
|
||||||
_filter_units_by_property() {
|
_filter_units_by_property() {
|
||||||
local property=$1 value=$2; shift 2
|
local property=$1 value=$2; shift 2
|
||||||
local -a units; units=("${(q-)@}")
|
local -a units; units=("${(q-)@}")
|
||||||
local -A props
|
local -A props
|
||||||
props=(${(f)"$(_call_program units "$service $_sys_service_mgr show --no-pager --property=\"Id,$property\" -- ${units} 2>/dev/null")"})
|
props=(${(f)"$(_call_program units "$service $_sys_service_mgr show --no-pager --property=\"Id,$property\" -- ${units} 2>/dev/null")"})
|
||||||
echo -E - "${(@g:o:)${(k@)props[(Re)$property=$value]}#Id=}"
|
echo -E - "${(@g:o:)${(k@)props[(Re)$property=$value]}#Id=}"
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_systemctl_get_non_template_names] )) ||
|
(( $+functions[_systemctl_get_non_template_names] )) ||
|
||||||
_systemctl_get_non_template_names() { echo -E - ${^${(R)${(f)"$(
|
_systemctl_get_non_template_names() { echo -E - ${^${(R)${(f)"$(
|
||||||
__systemctl $mode list-unit-files "$PREFIX*"
|
__systemctl $mode list-unit-files "$PREFIX*"
|
||||||
__systemctl $mode list-units --all "$PREFIX*"
|
__systemctl $mode list-units --all "$PREFIX*"
|
||||||
)"}:#*@.*}%%[[:space:]]*} }
|
)"}:#*@.*}%%[[:space:]]*} }
|
||||||
|
|
||||||
(( $+functions[_systemctl_get_template_names] )) ||
|
(( $+functions[_systemctl_get_template_names] )) ||
|
||||||
_systemctl_get_template_names() { echo -E - ${^${(M)${(f)"$(__systemctl list-unit-files "$PREFIX*" )"}##*@.[^[:space:]]##}%%@.*}\@ }
|
_systemctl_get_template_names() { echo -E - ${^${(M)${(f)"$(__systemctl list-unit-files "$PREFIX*" )"}##*@.[^[:space:]]##}%%@.*}\@ }
|
||||||
|
|
||||||
(( $+functions[_systemctl_active_units] )) ||
|
(( $+functions[_systemctl_active_units] )) ||
|
||||||
_systemctl_active_units() {_sys_active_units=( ${${(f)"$(__systemctl list-units "$PREFIX*" )"}%% *} )}
|
_systemctl_active_units() {_sys_active_units=( ${${(f)"$(__systemctl list-units "$PREFIX*" )"}%% *} )}
|
||||||
|
|
||||||
(( $+functions[_systemctl_startable_units] )) ||
|
(( $+functions[_systemctl_startable_units] )) ||
|
||||||
_systemctl_startable_units(){
|
_systemctl_startable_units(){
|
||||||
_sys_startable_units=( $( _filter_units_by_property ActiveState inactive $(
|
_sys_startable_units=( $( _filter_units_by_property ActiveState inactive $(
|
||||||
_filter_units_by_property CanStart yes ${${${(f)"$(
|
_filter_units_by_property CanStart yes ${${${(f)"$(
|
||||||
__systemctl $mode list-unit-files --state enabled,enabled-runtime,linked,linked-runtime,static,indirect,disabled,generated,transient "$PREFIX*"
|
__systemctl $mode list-unit-files --state enabled,enabled-runtime,linked,linked-runtime,static,indirect,disabled,generated,transient "$PREFIX*"
|
||||||
__systemctl $mode list-units --state inactive,failed "$PREFIX*"
|
__systemctl $mode list-units --state inactive,failed "$PREFIX*"
|
||||||
)"}:#*@.*}%%[[:space:]]*}
|
)"}:#*@.*}%%[[:space:]]*}
|
||||||
)) )
|
)) )
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_systemctl_restartable_units] )) ||
|
(( $+functions[_systemctl_restartable_units] )) ||
|
||||||
_systemctl_restartable_units(){
|
_systemctl_restartable_units(){
|
||||||
_sys_restartable_units=( $( _filter_units_by_property CanStart yes ${${${(f)"$(
|
_sys_restartable_units=( $( _filter_units_by_property CanStart yes ${${${(f)"$(
|
||||||
__systemctl $mode list-unit-files --state enabled,disabled,static "$PREFIX*"
|
__systemctl $mode list-unit-files --state enabled,disabled,static "$PREFIX*"
|
||||||
__systemctl $mode list-units "$PREFIX*"
|
__systemctl $mode list-units "$PREFIX*"
|
||||||
)"}:#*@.*}%%[[:space:]]*} ) )
|
)"}:#*@.*}%%[[:space:]]*} ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_systemctl_failed_units] )) ||
|
(( $+functions[_systemctl_failed_units] )) ||
|
||||||
_systemctl_failed_units() {_sys_failed_units=( ${${(f)"$(__systemctl list-units --state=failed "$PREFIX*" )"}%% *} ) }
|
_systemctl_failed_units() {_sys_failed_units=( ${${(f)"$(__systemctl list-units --state=failed "$PREFIX*" )"}%% *} ) }
|
||||||
|
|
||||||
(( $+functions[_systemctl_unit_state] )) ||
|
(( $+functions[_systemctl_unit_state] )) ||
|
||||||
_systemctl_unit_state() { typeset -gA _sys_unit_state; _sys_unit_state=( $(__systemctl list-unit-files "$PREFIX*" ) ) }
|
_systemctl_unit_state() { typeset -gA _sys_unit_state; _sys_unit_state=( $(__systemctl list-unit-files "$PREFIX*" ) ) }
|
||||||
|
|
||||||
local fun
|
local fun
|
||||||
# Completion functions for ALL_UNITS
|
# Completion functions for ALL_UNITS
|
||||||
@ -316,11 +316,11 @@ done
|
|||||||
|
|
||||||
(( $+functions[_systemctl_link] )) || _systemctl_link() {
|
(( $+functions[_systemctl_link] )) || _systemctl_link() {
|
||||||
_sd_unit_files
|
_sd_unit_files
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_systemctl_switch-root] )) || _systemctl_switch-root() {
|
(( $+functions[_systemctl_switch-root] )) || _systemctl_switch-root() {
|
||||||
_files
|
_files
|
||||||
}
|
}
|
||||||
|
|
||||||
# no systemctl completion for:
|
# no systemctl completion for:
|
||||||
# [STANDALONE]='daemon-reexec daemon-reload default
|
# [STANDALONE]='daemon-reexec daemon-reload default
|
||||||
@ -328,7 +328,7 @@ done
|
|||||||
# list-unit-files poweroff reboot rescue show-environment'
|
# list-unit-files poweroff reboot rescue show-environment'
|
||||||
|
|
||||||
(( $+functions[_systemctl_caching_policy] )) ||
|
(( $+functions[_systemctl_caching_policy] )) ||
|
||||||
_systemctl_caching_policy()
|
_systemctl_caching_policy()
|
||||||
{
|
{
|
||||||
local _sysunits
|
local _sysunits
|
||||||
local -a oldcache
|
local -a oldcache
|
||||||
@ -349,21 +349,21 @@ _systemctl_caching_policy()
|
|||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_systemctl_unit_states] )) ||
|
(( $+functions[_systemctl_unit_states] )) ||
|
||||||
_systemctl_unit_states() {
|
_systemctl_unit_states() {
|
||||||
local -a _states
|
local -a _states
|
||||||
_states=("${(fo)$(__systemctl --state=help)}")
|
_states=("${(fo)$(__systemctl --state=help)}")
|
||||||
_values -s , "${_states[@]}"
|
_values -s , "${_states[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_systemctl_unit_types] )) ||
|
(( $+functions[_systemctl_unit_types] )) ||
|
||||||
_systemctl_unit_types() {
|
_systemctl_unit_types() {
|
||||||
local -a _types
|
local -a _types
|
||||||
_types=("${(fo)$(__systemctl -t help)}")
|
_types=("${(fo)$(__systemctl -t help)}")
|
||||||
_values -s , "${_types[@]}"
|
_values -s , "${_types[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_systemctl_unit_properties] )) ||
|
(( $+functions[_systemctl_unit_properties] )) ||
|
||||||
_systemctl_unit_properties() {
|
_systemctl_unit_properties() {
|
||||||
if ( [[ ${+_sys_all_properties} -eq 0 ]] || _cache_invalid SYS_ALL_PROPERTIES$_sys_service_mgr ) ||
|
if ( [[ ${+_sys_all_properties} -eq 0 ]] || _cache_invalid SYS_ALL_PROPERTIES$_sys_service_mgr ) ||
|
||||||
! _retrieve_cache SYS_ALL_PROPERTIES$_sys_service_mgr;
|
! _retrieve_cache SYS_ALL_PROPERTIES$_sys_service_mgr;
|
||||||
then
|
then
|
||||||
@ -371,14 +371,14 @@ _systemctl_unit_properties() {
|
|||||||
_store_cache SYS_ALL_PROPERTIES$_sys_service_mgr _sys_all_properties
|
_store_cache SYS_ALL_PROPERTIES$_sys_service_mgr _sys_all_properties
|
||||||
fi
|
fi
|
||||||
_values -s , "${_sys_all_properties[@]}"
|
_values -s , "${_sys_all_properties[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_systemctl_job_modes] )) ||
|
(( $+functions[_systemctl_job_modes] )) ||
|
||||||
_systemctl_job_modes() {
|
_systemctl_job_modes() {
|
||||||
local -a _modes
|
local -a _modes
|
||||||
_modes=(fail replace replace-irreversibly isolate ignore-dependencies ignore-requirements flush)
|
_modes=(fail replace replace-irreversibly isolate ignore-dependencies ignore-requirements flush)
|
||||||
_values -s , "${_modes[@]}"
|
_values -s , "${_modes[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build arguments for "systemctl" to be used in completion.
|
# Build arguments for "systemctl" to be used in completion.
|
||||||
local -a _modes; _modes=("--user" "--system")
|
local -a _modes; _modes=("--user" "--system")
|
||||||
|
@ -79,5 +79,3 @@ case "$service" in
|
|||||||
;;
|
;;
|
||||||
*) _message 'eh?' ;;
|
*) _message 'eh?' ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#vim: set ft=zsh sw=4 ts=4 et
|
|
||||||
|
@ -2,33 +2,33 @@
|
|||||||
# SPDX-License-Identifier: LGPL-2.1+
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
|
|
||||||
(( $+functions[_systemd-analyze_log-level] )) ||
|
(( $+functions[_systemd-analyze_log-level] )) ||
|
||||||
_systemd-analyze_log-level() {
|
_systemd-analyze_log-level() {
|
||||||
local -a _levels
|
local -a _levels
|
||||||
_levels=(debug info notice warning err crit alert emerg)
|
_levels=(debug info notice warning err crit alert emerg)
|
||||||
_describe -t level 'logging level' _levels || compadd "$@"
|
_describe -t level 'logging level' _levels || compadd "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_systemd-analyze_log-target] )) ||
|
(( $+functions[_systemd-analyze_log-target] )) ||
|
||||||
_systemd-analyze_log-target() {
|
_systemd-analyze_log-target() {
|
||||||
local -a _targets
|
local -a _targets
|
||||||
_targets=(console journal kmsg journal-or-kmsg null)
|
_targets=(console journal kmsg journal-or-kmsg null)
|
||||||
_describe -t target 'logging target' _targets || compadd "$@"
|
_describe -t target 'logging target' _targets || compadd "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_systemd-analyze_verify] )) ||
|
(( $+functions[_systemd-analyze_verify] )) ||
|
||||||
_systemd-analyze_verify() {
|
_systemd-analyze_verify() {
|
||||||
_sd_unit_files
|
_sd_unit_files
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_systemd-analyze_service-watchdogs] )) ||
|
(( $+functions[_systemd-analyze_service-watchdogs] )) ||
|
||||||
_systemd-analyze_service-watchdogs() {
|
_systemd-analyze_service-watchdogs() {
|
||||||
local -a _states
|
local -a _states
|
||||||
_states=(on off)
|
_states=(on off)
|
||||||
_describe -t state 'state' _states || compadd "$@"
|
_describe -t state 'state' _states || compadd "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_systemd-analyze_commands] )) ||
|
(( $+functions[_systemd-analyze_commands] )) ||
|
||||||
_systemd-analyze_commands(){
|
_systemd-analyze_commands(){
|
||||||
local -a _systemd_analyze_cmds
|
local -a _systemd_analyze_cmds
|
||||||
# Descriptions taken from systemd-analyze --help.
|
# Descriptions taken from systemd-analyze --help.
|
||||||
_systemd_analyze_cmds=(
|
_systemd_analyze_cmds=(
|
||||||
@ -62,7 +62,7 @@ _systemd-analyze_commands(){
|
|||||||
_message "unknown systemd-analyze command: $words[1]"
|
_message "unknown systemd-analyze command: $words[1]"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_arguments \
|
_arguments \
|
||||||
{-h,--help}'[Show help text]' \
|
{-h,--help}'[Show help text]' \
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#compdef systemd-resolve
|
#compdef systemd-resolve
|
||||||
# SPDX-License-Identifier: LGPL-2.1+
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
|
|
||||||
#
|
#
|
||||||
# This file is part of systemd.
|
# This file is part of systemd.
|
||||||
#
|
#
|
||||||
@ -18,32 +17,32 @@
|
|||||||
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
(( $+functions[_systemd-resolve_protocols] )) ||
|
(( $+functions[_systemd-resolve_protocols] )) ||
|
||||||
_systemd-resolve_protocols() {
|
_systemd-resolve_protocols() {
|
||||||
local -a _protocol
|
local -a _protocol
|
||||||
_protocol=( $(_call_program protocol ${service} --legend=no --protocol help; echo help) )
|
_protocol=( $(_call_program protocol ${service} --legend=no --protocol help; echo help) )
|
||||||
_values 'protocol' "$_protocol[@]"
|
_values 'protocol' "$_protocol[@]"
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_systemd-resolve_types] )) ||
|
(( $+functions[_systemd-resolve_types] )) ||
|
||||||
_systemd-resolve_types() {
|
_systemd-resolve_types() {
|
||||||
local -a _type
|
local -a _type
|
||||||
_type=( $(_call_program type ${service} --legend=no --type help; echo help) )
|
_type=( $(_call_program type ${service} --legend=no --type help; echo help) )
|
||||||
_values 'type' "$_type[@]"
|
_values 'type' "$_type[@]"
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_systemd-resolve_classes] )) ||
|
(( $+functions[_systemd-resolve_classes] )) ||
|
||||||
_systemd-resolve_classes() {
|
_systemd-resolve_classes() {
|
||||||
local -a _class
|
local -a _class
|
||||||
_class=( $(_call_program class ${service} --legend=no --class help; echo help) )
|
_class=( $(_call_program class ${service} --legend=no --class help; echo help) )
|
||||||
_values 'class' "$_class[@]"
|
_values 'class' "$_class[@]"
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_systemd-resolve_none] )) ||
|
(( $+functions[_systemd-resolve_none] )) ||
|
||||||
_systemd-resolve_none() {
|
_systemd-resolve_none() {
|
||||||
_alternative : \
|
_alternative : \
|
||||||
'domain:DNS address:' \
|
'domain:DNS address:' \
|
||||||
'address:email address:'
|
'address:email address:'
|
||||||
}
|
}
|
||||||
|
|
||||||
_arguments \
|
_arguments \
|
||||||
{-h,--help}'[Print a short help text and exit]' \
|
{-h,--help}'[Print a short help text and exit]' \
|
||||||
|
@ -9,18 +9,18 @@ __systemctl() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[__systemd-run_get_slices] )) ||
|
(( $+functions[__systemd-run_get_slices] )) ||
|
||||||
__systemd-run_get_slices () {
|
__systemd-run_get_slices () {
|
||||||
__systemctl list-units --all -t slice \
|
__systemctl list-units --all -t slice \
|
||||||
| { while read -r a b; do echo $a; done; };
|
| { while read -r a b; do echo $a; done; };
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[__systemd-run_slices] )) ||
|
(( $+functions[__systemd-run_slices] )) ||
|
||||||
__systemd-run_slices () {
|
__systemd-run_slices () {
|
||||||
local -a _slices
|
local -a _slices
|
||||||
_slices=(${(fo)"$(__systemd-run_get_slices)"})
|
_slices=(${(fo)"$(__systemd-run_get_slices)"})
|
||||||
typeset -U _slices
|
typeset -U _slices
|
||||||
_describe 'slices' _slices
|
_describe 'slices' _slices
|
||||||
}
|
}
|
||||||
|
|
||||||
_arguments \
|
_arguments \
|
||||||
{-h,--help}'[Show help message]' \
|
{-h,--help}'[Show help message]' \
|
||||||
|
@ -142,7 +142,6 @@ _udevadm_commands(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_arguments \
|
_arguments \
|
||||||
'--debug[Print debug messages to stderr]' \
|
'--debug[Print debug messages to stderr]' \
|
||||||
'--version[Print version number]' \
|
'--version[Print version number]' \
|
||||||
|
Reference in New Issue
Block a user