style(shell-completion): remove unnecessary backslashes

This commit is contained in:
Eisuke Kawashima
2025-07-14 20:24:25 +09:00
parent 5300aa7a1d
commit 12e64a4848
20 changed files with 74 additions and 74 deletions
+30 -30
View File
@@ -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