mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
style(shell-completion): remove unnecessary backslashes
This commit is contained in:
@@ -26,8 +26,8 @@ __contains_word () {
|
||||
|
||||
__get_machines() {
|
||||
local a b
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \
|
||||
{ while read a b; do echo " $a"; done; } | \
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
|
||||
{ while read a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ __contains_word() {
|
||||
|
||||
__get_machines() {
|
||||
local a b
|
||||
{ machinectl list-images --full --no-legend --no-pager 2>/dev/null; machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \
|
||||
{ while read a b; do echo " $a"; done; } | \
|
||||
{ machinectl list-images --full --no-legend --no-pager 2>/dev/null; machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
|
||||
{ while read a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ __contains_word () {
|
||||
|
||||
__get_machines() {
|
||||
local a b
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \
|
||||
{ while read a b; do echo " $a"; done; } | \
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
|
||||
{ while read a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ __get_all_seats () { loginctl --no-legend list-seats | { while read -r a b
|
||||
|
||||
__get_machines() {
|
||||
local a b
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \
|
||||
{ while read a b; do echo " $a"; done; } | \
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
|
||||
{ while read a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ __contains_word() {
|
||||
|
||||
__get_machines() {
|
||||
local a b
|
||||
{ machinectl list-images --full --no-legend --no-pager 2>/dev/null; machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \
|
||||
{ while read a b; do echo " $a"; done; } | \
|
||||
{ machinectl list-images --full --no-legend --no-pager 2>/dev/null; machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
|
||||
{ while read a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ __contains_word () {
|
||||
|
||||
__get_machines() {
|
||||
local a b
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \
|
||||
{ while read a b; do echo " $a"; done; } | \
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
|
||||
{ while read a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@ __systemctl() {
|
||||
systemctl --system --full --no-legend --no-pager --plain "$@"
|
||||
}
|
||||
|
||||
__get_slice_units () { __systemctl list-units --all -t slice \
|
||||
| { while read -r a b c d; do echo " $a"; done; }; }
|
||||
__get_slice_units () { __systemctl list-units --all -t slice |
|
||||
{ while read -r a b c d; do echo " $a"; done; }; }
|
||||
|
||||
__get_machines() {
|
||||
local a b
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \
|
||||
{ while read a b; do echo " $a"; done; } | \
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
|
||||
{ while read a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
||||
@@ -55,20 +55,20 @@ __filter_units_by_properties () {
|
||||
}
|
||||
{% endraw %}
|
||||
|
||||
__get_all_units () { { __systemctl $1 list-unit-files "$2*"; __systemctl $1 list-units --all "$2*"; } \
|
||||
| { while read -r a b; do echo " $a"; done; }; }
|
||||
__get_non_template_units() { { __systemctl $1 list-unit-files "$2*"; __systemctl $1 list-units --all "$2*"; } \
|
||||
| { while read -r a b; do [[ $a =~ @\. ]] || echo " $a"; done; }; }
|
||||
__get_template_names () { __systemctl $1 list-unit-files "$2*" \
|
||||
| { while read -r a b; do [[ $a =~ @\. ]] && echo " ${a%%@.*}@"; done; }; }
|
||||
__get_active_units () { __systemctl $1 list-units "$2*" \
|
||||
| { while read -r a b; do echo " $a"; done; }; }
|
||||
__get_active_services() { __systemctl $1 list-units "$2*.service" \
|
||||
| { while read -r a b; do echo " $a"; done; }; }
|
||||
__get_all_units () { { __systemctl $1 list-unit-files "$2*"; __systemctl $1 list-units --all "$2*"; } |
|
||||
{ while read -r a b; do echo " $a"; done; }; }
|
||||
__get_non_template_units() { { __systemctl $1 list-unit-files "$2*"; __systemctl $1 list-units --all "$2*"; } |
|
||||
{ while read -r a b; do [[ $a =~ @\. ]] || echo " $a"; done; }; }
|
||||
__get_template_names () { __systemctl $1 list-unit-files "$2*" |
|
||||
{ while read -r a b; do [[ $a =~ @\. ]] && echo " ${a%%@.*}@"; done; }; }
|
||||
__get_active_units () { __systemctl $1 list-units "$2*" |
|
||||
{ while read -r a b; do echo " $a"; done; }; }
|
||||
__get_active_services() { __systemctl $1 list-units "$2*.service" |
|
||||
{ while read -r a b; do echo " $a"; done; }; }
|
||||
|
||||
__get_not_masked_unit_files() {
|
||||
# filter out masked, not-found, or template units.
|
||||
__systemctl $1 list-unit-files --state enabled,enabled-runtime,linked,linked-runtime,static,indirect,disabled,generated,transient "$2*" | \
|
||||
__systemctl $1 list-unit-files --state enabled,enabled-runtime,linked,linked-runtime,static,indirect,disabled,generated,transient "$2*" |
|
||||
{ while read -r a b; do [[ $a =~ @\. ]] || echo " $a"; done; }
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ __get_startable_units () {
|
||||
__filter_units_by_properties $1 ActiveState=inactive,CanStart=yes $(
|
||||
{ __get_not_masked_unit_files $1 $2
|
||||
# get inactive template units
|
||||
__systemctl $1 list-units --state inactive,failed "$2*" | \
|
||||
__systemctl $1 list-units --state inactive,failed "$2*" |
|
||||
{ while read -r a b c; do [[ $b == "loaded" ]] && echo " $a"; done; }
|
||||
} | sort -u )
|
||||
}
|
||||
@@ -107,14 +107,14 @@ __get_reloadable_units () {
|
||||
} | sort -u )
|
||||
}
|
||||
|
||||
__get_failed_units() { __systemctl $1 list-units "$2*" \
|
||||
| while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; done; }
|
||||
__get_enabled_units() { __systemctl $1 list-unit-files "$2*" \
|
||||
| while read -r a b c ; do [[ $b == "enabled" ]] && echo " $a"; done; }
|
||||
__get_disabled_units() { __systemctl $1 list-unit-files "$2*" \
|
||||
| while read -r a b c ; do [[ $b == "disabled" ]] && echo " $a"; done; }
|
||||
__get_masked_units() { __systemctl $1 list-unit-files "$2*" \
|
||||
| while read -r a b c ; do [[ $b == "masked" ]] && echo " $a"; done; }
|
||||
__get_failed_units() { __systemctl $1 list-units "$2*" |
|
||||
while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; done; }
|
||||
__get_enabled_units() { __systemctl $1 list-unit-files "$2*" |
|
||||
while read -r a b c ; do [[ $b == "enabled" ]] && echo " $a"; done; }
|
||||
__get_disabled_units() { __systemctl $1 list-unit-files "$2*" |
|
||||
while read -r a b c ; do [[ $b == "disabled" ]] && echo " $a"; done; }
|
||||
__get_masked_units() { __systemctl $1 list-unit-files "$2*" |
|
||||
while read -r a b c ; do [[ $b == "masked" ]] && echo " $a"; done; }
|
||||
__get_all_unit_files() { __systemctl $1 list-unit-files "$2*" | while read -r a b; do echo " $a"; done; }
|
||||
|
||||
__get_machines() {
|
||||
@@ -331,10 +331,10 @@ _systemctl () {
|
||||
compopt -o filenames
|
||||
|
||||
elif __contains_word "$verb" ${VERBS[TARGET_AND_UNITS]}; then
|
||||
if __contains_word "$prev" ${VERBS[TARGET_AND_UNITS]} \
|
||||
|| __contains_word "$prev" ${OPTS[STANDALONE]}; then
|
||||
comps=$( __systemctl $mode list-unit-files --type target --all "$cur*" \
|
||||
| { while read -r a b; do echo " $a"; done; } )
|
||||
if __contains_word "$prev" ${VERBS[TARGET_AND_UNITS]} ||
|
||||
__contains_word "$prev" ${OPTS[STANDALONE]}; then
|
||||
comps=$( __systemctl $mode list-unit-files --type target --all "$cur*" |
|
||||
{ while read -r a b; do echo " $a"; done; } )
|
||||
else
|
||||
comps=$( __get_all_unit_files $mode "$cur" )
|
||||
fi
|
||||
@@ -347,13 +347,13 @@ _systemctl () {
|
||||
comps=$( __systemctl $mode list-jobs | { while read -r a b; do echo " $a"; done; } )
|
||||
|
||||
elif [ "$verb" = 'unset-environment' ]; then
|
||||
comps=$( __systemctl $mode show-environment \
|
||||
| while read -r line; do echo " ${line%%=*}"; done )
|
||||
comps=$( __systemctl $mode show-environment |
|
||||
while read -r line; do echo " ${line%%=*}"; done )
|
||||
compopt -o nospace
|
||||
|
||||
elif [ "$verb" = 'set-environment' ]; then
|
||||
comps=$( __systemctl $mode show-environment \
|
||||
| while read -r line; do echo " ${line%%=*}="; done )
|
||||
comps=$( __systemctl $mode show-environment |
|
||||
while read -r line; do echo " ${line%%=*}="; done )
|
||||
compopt -o nospace
|
||||
|
||||
elif [ "$verb" = 'import-environment' ]; then
|
||||
@@ -365,8 +365,8 @@ _systemctl () {
|
||||
compopt -o filenames
|
||||
|
||||
elif __contains_word "$verb" ${VERBS[TARGETS]}; then
|
||||
comps=$( __systemctl $mode list-unit-files --type target --full --all "$cur*" \
|
||||
| { while read -r a b; do echo " $a"; done; } )
|
||||
comps=$( __systemctl $mode list-unit-files --type target --full --all "$cur*" |
|
||||
{ while read -r a b; do echo " $a"; done; } )
|
||||
elif __contains_word "$verb" ${VERBS[LOG_LEVEL]}; then
|
||||
comps='debug info notice warning err crit alert emerg'
|
||||
elif __contains_word "$verb" ${VERBS[LOG_TARGET]}; then
|
||||
|
||||
@@ -28,18 +28,18 @@ __contains_word () {
|
||||
|
||||
__get_machines() {
|
||||
local a b
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \
|
||||
{ while read a b; do echo " $a"; done; } | \
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
|
||||
{ while read a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
__get_units_all() {
|
||||
systemctl list-units --no-legend --no-pager --plain --all $1 | \
|
||||
systemctl list-units --no-legend --no-pager --plain --all $1 |
|
||||
{ while read -r a b c; do echo " $a"; done; }
|
||||
}
|
||||
|
||||
__get_services() {
|
||||
systemctl list-units --no-legend --no-pager --plain -t service --all $1 | \
|
||||
systemctl list-units --no-legend --no-pager --plain -t service --all $1 |
|
||||
{ while read -r a b c; do [[ $b == "loaded" ]]; echo " $a"; done; }
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ __contains_word() {
|
||||
|
||||
__get_machines() {
|
||||
local a b
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \
|
||||
{ while read a b; do echo " $a"; done; } | \
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
|
||||
{ while read a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ __contains_word() {
|
||||
|
||||
__get_machines() {
|
||||
local a b
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \
|
||||
{ while read a b; do echo " $a"; done; } | \
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
|
||||
{ while read a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
||||
@@ -26,14 +26,14 @@ __contains_word() {
|
||||
|
||||
__get_tpm2_devices() {
|
||||
local a b c
|
||||
systemd-creds --no-legend --quiet --tpm2-device=list 2>/dev/null | \
|
||||
systemd-creds --no-legend --quiet --tpm2-device=list 2>/dev/null |
|
||||
{ while read -r a b c; do echo " $a"; done; }
|
||||
}
|
||||
|
||||
__get_creds() {
|
||||
local a b c
|
||||
local mode=$1; shift 1
|
||||
systemd-creds list $mode --no-legend --no-pager $1 2>/dev/null | \
|
||||
systemd-creds list $mode --no-legend --no-pager $1 2>/dev/null |
|
||||
{ while read -r a b c; do echo " $a"; done; }
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ __get_slices() {
|
||||
|
||||
__get_machines() {
|
||||
local a b
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \
|
||||
{ while read a b; do echo " $a"; done; } | \
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
|
||||
{ while read a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ __systemctl() {
|
||||
systemctl $mode --full --no-legend --no-pager --plain "$@"
|
||||
}
|
||||
|
||||
__get_slice_units () { __systemctl $1 list-units --all -t slice \
|
||||
| { while read -r a b c d; do echo " $a"; done; }; }
|
||||
__get_slice_units () { __systemctl $1 list-units --all -t slice |
|
||||
{ while read -r a b c d; do echo " $a"; done; }; }
|
||||
|
||||
__get_properties () {
|
||||
systemd-analyze transient-settings scope service 2>/dev/null |
|
||||
@@ -47,8 +47,8 @@ __get_timer_properties () {
|
||||
|
||||
__get_machines() {
|
||||
local a b
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \
|
||||
{ while read -r a b; do echo " $a"; done; } | \
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
|
||||
{ while read -r a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ __contains_word () {
|
||||
|
||||
__get_machines() {
|
||||
local a b
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \
|
||||
{ while read a b; do echo " $a"; done; } | \
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
|
||||
{ while read a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ __get_all_device_nodes() {
|
||||
}
|
||||
|
||||
__get_all_device_units() {
|
||||
systemctl list-units -t device --full --no-legend --no-pager --plain 2>/dev/null | \
|
||||
systemctl list-units -t device --full --no-legend --no-pager --plain 2>/dev/null |
|
||||
{ while read -r a b; do echo "$a"; done; }
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
(( $+functions[_localectl_set-locale] )) ||
|
||||
_localectl_set-locale() {
|
||||
local -a _locales locale_fields
|
||||
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
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
(( $+functions[__sd_machines_get_machines] )) ||
|
||||
__sd_machines_get_machines () {
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \
|
||||
{ while read a b; do echo "$a"; done; } | \
|
||||
{ machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
|
||||
{ while read a b; do echo "$a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
||||
@@ -119,8 +119,8 @@
|
||||
while _tags; do
|
||||
for i in $groups; do
|
||||
if _requested ${i//_/-}-commands; then
|
||||
_describe -t ${i//_/-}-commands "${i//_/ } command" ${i}_commands \
|
||||
&& ret=0
|
||||
_describe -t ${i//_/-}-commands "${i//_/ } command" ${i}_commands &&
|
||||
ret=0
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
@@ -10,8 +10,8 @@ __systemctl() {
|
||||
|
||||
(( $+functions[__systemd-run_get_slices] )) ||
|
||||
__systemd-run_get_slices () {
|
||||
__systemctl list-units --all -t slice \
|
||||
| { while read -r a b; do echo $a; done; }
|
||||
__systemctl list-units --all -t slice |
|
||||
{ while read -r a b; do echo $a; done; }
|
||||
}
|
||||
|
||||
(( $+functions[__systemd-run_slices] )) ||
|
||||
|
||||
Reference in New Issue
Block a user