1
1
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:
Zbigniew Jędrzejewski-Szmek
2019-04-05 11:39:14 +02:00
parent cc5549ca12
commit 843cfcb15c
39 changed files with 2518 additions and 2524 deletions

View File

@ -3,7 +3,6 @@
#
# This file is part of systemd.
#
#
# 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
# the Free Software Foundation; either version 2.1 of the License, or

View File

@ -3,7 +3,6 @@
#
# This file is part of systemd.
#
#
# 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
# the Free Software Foundation; either version 2.1 of the License, or

View File

@ -25,9 +25,9 @@ __contains_word () {
done
}
__locale_fields=( LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME \
LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER \
LC_NAME LC_ADDRESS LC_TELEPHONE \
__locale_fields=( LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME
LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER
LC_NAME LC_ADDRESS LC_TELEPHONE
LC_MEASUREMENT LC_IDENTIFICATION )
# LC_ALL is omitted on purpose

View File

@ -3,7 +3,6 @@
#
# This file is part of systemd.
#
#
# 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
# the Free Software Foundation; either version 2.1 of the License, or
@ -43,8 +42,9 @@ _machinectl() {
local -A VERBS=(
[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
image-status show-image clone rename read-only remove set-limit export-tar export-raw'
[MACHINES]='status show start stop login shell enable disable poweroff reboot terminate kill bind
copy-to copy-from image-status show-image clone rename read-only remove set-limit
export-tar export-raw'
[FILE]='import-tar import-raw'
)

View File

@ -3,7 +3,6 @@
#
# This file is part of systemd.
#
#
# 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
# the Free Software Foundation; either version 2.1 of the License, or

View File

@ -3,7 +3,6 @@
#
# This file is part of systemd.
#
#
# 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
# the Free Software Foundation; either version 2.1 of the License, or

View File

@ -3,7 +3,6 @@
#
# This file is part of systemd.
#
#
# 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
# the Free Software Foundation; either version 2.1 of the License, or

View File

@ -3,7 +3,6 @@
#
# This file is part of systemd.
#
#
# 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
# the Free Software Foundation; either version 2.1 of the License, or

View File

@ -3,7 +3,6 @@
#
# This file is part of systemd.
#
#
# 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
# the Free Software Foundation; either version 2.1 of the License, or

View File

@ -3,7 +3,6 @@
#
# This file is part of systemd.
#
#
# 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
# the Free Software Foundation; either version 2.1 of the License, or

View File

@ -3,7 +3,6 @@
#
# This file is part of systemd.
#
#
# 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
# the Free Software Foundation; either version 2.1 of the License, or
@ -63,14 +62,16 @@ _systemd_nspawn() {
local i verb comps
local -A OPTS=(
[STANDALONE]='-h --help --version --private-network -b --boot --read-only -q --quiet --share-system --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
-S --slice -E --setenv -Z --selinux-context -L --selinux-apifs-context --register --network-interface --network-bridge
--personality -i --image --tmpfs --volatile --network-macvlan --kill-signal --template --notify-ready --root-hash
--chdir --pivot-root --property --private-users --network-namespace-path --network-ipvlan --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'
[STANDALONE]='-h --help --version --private-network -b --boot --read-only -q --quiet --share-system
--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 -S --slice -E --setenv -Z --selinux-context -L --selinux-apifs-context
--register --network-interface --network-bridge --personality -i --image --tmpfs
--volatile --network-macvlan --kill-signal --template --notify-ready --root-hash --chdir
--pivot-root --property --private-users --network-namespace-path --network-ipvlan
--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

View File

@ -110,6 +110,7 @@ _udevadm() {
local IFS=$'\n'
fi
;;
'trigger')
if __contains_word "$prev" ${OPTS[TRIGGER_ARG]}; then
case $prev in
@ -141,6 +142,7 @@ _udevadm() {
local IFS=$'\n'
fi
;;
'settle')
if __contains_word "$prev" ${OPTS[SETTLE]}; then
case $prev in
@ -157,6 +159,7 @@ _udevadm() {
comps="${OPTS[COMMON]} ${OPTS[SETTLE]}"
;;
'control')
if __contains_word "$prev" ${OPTS[CONTROL_ARG]}; then
case $prev in
@ -173,6 +176,7 @@ _udevadm() {
comps="${OPTS[COMMON]} ${OPTS[CONTROL_STANDALONE]} ${OPTS[CONTROL_ARG]}"
;;
'monitor')
if __contains_word "$prev" ${OPTS[MONITOR_ARG]}; then
case $prev in
@ -186,6 +190,7 @@ _udevadm() {
comps="${OPTS[COMMON]} ${OPTS[MONITOR_STANDALONE]} ${OPTS[MONITOR_ARG]}"
;;
'test')
if __contains_word "$prev" ${OPTS[TEST]}; then
case $prev in
@ -207,6 +212,7 @@ _udevadm() {
local IFS=$'\n'
fi
;;
'test-builtin')
for ((i=0; i < COMP_CWORD; i++)); do
if __contains_word "${COMP_WORDS[i]}" "${builtins[@]}"; then
@ -224,6 +230,7 @@ _udevadm() {
local IFS=$'\n'
fi
;;
*)
comps=${VERBS[*]}
;;

View File

@ -25,5 +25,3 @@ _arguments \
'1::add or remove:(add remove)' \
'2::kernel versions:_kernel-install_kernels' \
'3::kernel images:_kernel-install_images'
#vim: set ft=zsh sw=4 ts=4 et

View File

@ -31,8 +31,8 @@ _loginctl_all_seats() {
local fun
# Completion functions for SESSIONS
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}
_loginctl_all_sessions
@ -47,13 +47,13 @@ for fun in session-status show-session activate lock-session unlock-session term
local expl
_wanted systemd-sessions expl session compadd "$@" -a _sys_all_sessions
fi
}
}
done
# Completion functions for USERS
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}
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
_wanted users expl user compadd "$@" -a _sys_all_users
fi
}
}
done
# Completion functions for SEATS
(( $+functions[_loginctl_seats] )) || _loginctl_seats()
{
(( $+functions[_loginctl_seats] )) ||
_loginctl_seats() {
local -a _sys_all_seats{,_descr}
_loginctl_all_seats
@ -95,13 +95,13 @@ done
fi
}
for fun in seat-status show-seat terminate-seat ; do
(( $+functions[_loginctl_$fun] )) || _loginctl_$fun()
{ _loginctl_seats }
(( $+functions[_loginctl_$fun] )) ||
_loginctl_$fun() { _loginctl_seats }
done
# Completion functions for ATTACH
(( $+functions[_loginctl_attach] )) || _loginctl_attach()
{
(( $+functions[_loginctl_attach] )) ||
_loginctl_attach() {
_arguments -w -C -S -s \
':seat:_loginctl_seats' \
'*:device:_files'
@ -110,8 +110,8 @@ done
# no loginctl completion for:
# [STANDALONE]='list-sessions list-users list-seats flush-devices'
(( $+functions[_loginctl_commands] )) || _loginctl_commands()
{
(( $+functions[_loginctl_commands] )) ||
_loginctl_commands() {
local -a _loginctl_cmds
_loginctl_cmds=(
"list-sessions:List sessions"

View File

@ -2,12 +2,12 @@
# SPDX-License-Identifier: LGPL-2.1+
(( $+functions[__machinectl_get_machines] )) ||
__machinectl_get_machines () {
__machinectl_get_machines () {
machinectl --no-legend list-images | {while read -r a b; do echo $a; done;}
}
}
(( $+functions[_machinectl_machines] )) ||
_machinectl_machines() {
_machinectl_machines() {
local -a _machines
_machines=("${(fo)$(__machinectl_get_machines)}")
typeset -U _machines
@ -16,7 +16,7 @@ _machinectl_machines() {
else
_message 'no machines'
fi
}
}
(( $+functions[_machinectl_commands] )) || _machinectl_commands()
{

View File

@ -2,7 +2,7 @@
# SPDX-License-Identifier: LGPL-2.1+
(( $+functions[_networkctl_commands] )) ||
_networkctl_commands(){
_networkctl_commands() {
local -a _networkctl_cmds
_networkctl_cmds=(
'list:List existing links'
@ -27,7 +27,7 @@ _networkctl_commands(){
_message "no more options"
fi
fi
}
}
_arguments \
{-a,--all}'[Show all links with status]' \

View File

@ -2,9 +2,9 @@
# SPDX-License-Identifier: LGPL-2.1+
(( $+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;};
}
}
local -a _machines
_machines=("${(fo)$(__sd_machines_get_machines)}")

View File

@ -104,7 +104,7 @@ __systemctl()
# Fills the unit list
(( $+functions[_systemctl_all_units] )) ||
_systemctl_all_units()
_systemctl_all_units()
{
if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid 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
(( $+functions[_systemctl_really_all_units] )) ||
_systemctl_really_all_units()
_systemctl_really_all_units()
{
local -a all_unit_files;
local -a really_all_units;
@ -132,49 +132,49 @@ _systemctl_really_all_units()
}
(( $+functions[_filter_units_by_property] )) ||
_filter_units_by_property() {
_filter_units_by_property() {
local property=$1 value=$2; shift 2
local -a units; units=("${(q-)@}")
local -A props
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=}"
}
}
(( $+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-units --all "$PREFIX*"
)"}:#*@.*}%%[[:space:]]*} }
(( $+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] )) ||
_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] )) ||
_systemctl_startable_units(){
_systemctl_startable_units(){
_sys_startable_units=( $( _filter_units_by_property ActiveState inactive $(
_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-units --state inactive,failed "$PREFIX*"
)"}:#*@.*}%%[[:space:]]*}
)) )
}
}
(( $+functions[_systemctl_restartable_units] )) ||
_systemctl_restartable_units(){
_systemctl_restartable_units(){
_sys_restartable_units=( $( _filter_units_by_property CanStart yes ${${${(f)"$(
__systemctl $mode list-unit-files --state enabled,disabled,static "$PREFIX*"
__systemctl $mode list-units "$PREFIX*"
)"}:#*@.*}%%[[:space:]]*} ) )
}
}
(( $+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] )) ||
_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
# Completion functions for ALL_UNITS
@ -316,11 +316,11 @@ done
(( $+functions[_systemctl_link] )) || _systemctl_link() {
_sd_unit_files
}
}
(( $+functions[_systemctl_switch-root] )) || _systemctl_switch-root() {
_files
}
}
# no systemctl completion for:
# [STANDALONE]='daemon-reexec daemon-reload default
@ -328,7 +328,7 @@ done
# list-unit-files poweroff reboot rescue show-environment'
(( $+functions[_systemctl_caching_policy] )) ||
_systemctl_caching_policy()
_systemctl_caching_policy()
{
local _sysunits
local -a oldcache
@ -349,21 +349,21 @@ _systemctl_caching_policy()
}
(( $+functions[_systemctl_unit_states] )) ||
_systemctl_unit_states() {
_systemctl_unit_states() {
local -a _states
_states=("${(fo)$(__systemctl --state=help)}")
_values -s , "${_states[@]}"
}
}
(( $+functions[_systemctl_unit_types] )) ||
_systemctl_unit_types() {
_systemctl_unit_types() {
local -a _types
_types=("${(fo)$(__systemctl -t help)}")
_values -s , "${_types[@]}"
}
}
(( $+functions[_systemctl_unit_properties] )) ||
_systemctl_unit_properties() {
_systemctl_unit_properties() {
if ( [[ ${+_sys_all_properties} -eq 0 ]] || _cache_invalid SYS_ALL_PROPERTIES$_sys_service_mgr ) ||
! _retrieve_cache SYS_ALL_PROPERTIES$_sys_service_mgr;
then
@ -371,14 +371,14 @@ _systemctl_unit_properties() {
_store_cache SYS_ALL_PROPERTIES$_sys_service_mgr _sys_all_properties
fi
_values -s , "${_sys_all_properties[@]}"
}
}
(( $+functions[_systemctl_job_modes] )) ||
_systemctl_job_modes() {
_systemctl_job_modes() {
local -a _modes
_modes=(fail replace replace-irreversibly isolate ignore-dependencies ignore-requirements flush)
_values -s , "${_modes[@]}"
}
}
# Build arguments for "systemctl" to be used in completion.
local -a _modes; _modes=("--user" "--system")

View File

@ -79,5 +79,3 @@ case "$service" in
;;
*) _message 'eh?' ;;
esac
#vim: set ft=zsh sw=4 ts=4 et

View File

@ -2,33 +2,33 @@
# SPDX-License-Identifier: LGPL-2.1+
(( $+functions[_systemd-analyze_log-level] )) ||
_systemd-analyze_log-level() {
_systemd-analyze_log-level() {
local -a _levels
_levels=(debug info notice warning err crit alert emerg)
_describe -t level 'logging level' _levels || compadd "$@"
}
}
(( $+functions[_systemd-analyze_log-target] )) ||
_systemd-analyze_log-target() {
_systemd-analyze_log-target() {
local -a _targets
_targets=(console journal kmsg journal-or-kmsg null)
_describe -t target 'logging target' _targets || compadd "$@"
}
}
(( $+functions[_systemd-analyze_verify] )) ||
_systemd-analyze_verify() {
_systemd-analyze_verify() {
_sd_unit_files
}
}
(( $+functions[_systemd-analyze_service-watchdogs] )) ||
_systemd-analyze_service-watchdogs() {
_systemd-analyze_service-watchdogs() {
local -a _states
_states=(on off)
_describe -t state 'state' _states || compadd "$@"
}
}
(( $+functions[_systemd-analyze_commands] )) ||
_systemd-analyze_commands(){
_systemd-analyze_commands(){
local -a _systemd_analyze_cmds
# Descriptions taken from systemd-analyze --help.
_systemd_analyze_cmds=(
@ -62,7 +62,7 @@ _systemd-analyze_commands(){
_message "unknown systemd-analyze command: $words[1]"
fi
fi
}
}
_arguments \
{-h,--help}'[Show help text]' \

View File

@ -1,6 +1,5 @@
#compdef systemd-resolve
# SPDX-License-Identifier: LGPL-2.1+
#
# This file is part of systemd.
#
@ -18,32 +17,32 @@
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
(( $+functions[_systemd-resolve_protocols] )) ||
_systemd-resolve_protocols() {
_systemd-resolve_protocols() {
local -a _protocol
_protocol=( $(_call_program protocol ${service} --legend=no --protocol help; echo help) )
_values 'protocol' "$_protocol[@]"
}
}
(( $+functions[_systemd-resolve_types] )) ||
_systemd-resolve_types() {
_systemd-resolve_types() {
local -a _type
_type=( $(_call_program type ${service} --legend=no --type help; echo help) )
_values 'type' "$_type[@]"
}
}
(( $+functions[_systemd-resolve_classes] )) ||
_systemd-resolve_classes() {
_systemd-resolve_classes() {
local -a _class
_class=( $(_call_program class ${service} --legend=no --class help; echo help) )
_values 'class' "$_class[@]"
}
}
(( $+functions[_systemd-resolve_none] )) ||
_systemd-resolve_none() {
_systemd-resolve_none() {
_alternative : \
'domain:DNS address:' \
'address:email address:'
}
}
_arguments \
{-h,--help}'[Print a short help text and exit]' \

View File

@ -9,18 +9,18 @@ __systemctl() {
}
(( $+functions[__systemd-run_get_slices] )) ||
__systemd-run_get_slices () {
__systemd-run_get_slices () {
__systemctl list-units --all -t slice \
| { while read -r a b; do echo $a; done; };
}
}
(( $+functions[__systemd-run_slices] )) ||
__systemd-run_slices () {
__systemd-run_slices () {
local -a _slices
_slices=(${(fo)"$(__systemd-run_get_slices)"})
typeset -U _slices
_describe 'slices' _slices
}
}
_arguments \
{-h,--help}'[Show help message]' \

View File

@ -142,7 +142,6 @@ _udevadm_commands(){
fi
}
_arguments \
'--debug[Print debug messages to stderr]' \
'--version[Print version number]' \