From: Eisuke Kawashima Date: Mon, 14 Jul 2025 07:01:38 +0000 (+0900) Subject: style(shell-completion): remove unnecessary backslashes X-Git-Tag: v258-rc1~57^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=12e64a4848043e453ff2af77039e8ea7cf0e6f7f;p=thirdparty%2Fsystemd.git style(shell-completion): remove unnecessary backslashes --- diff --git a/shell-completion/bash/busctl b/shell-completion/bash/busctl index 06eb29ac5f0..4527b5bdbe8 100644 --- a/shell-completion/bash/busctl +++ b/shell-completion/bash/busctl @@ -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 } diff --git a/shell-completion/bash/importctl b/shell-completion/bash/importctl index 6b9316b7acd..0eed6defd8d 100644 --- a/shell-completion/bash/importctl +++ b/shell-completion/bash/importctl @@ -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 } diff --git a/shell-completion/bash/journalctl b/shell-completion/bash/journalctl index 1892e6f5f54..2c4ffffe07e 100644 --- a/shell-completion/bash/journalctl +++ b/shell-completion/bash/journalctl @@ -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 } diff --git a/shell-completion/bash/loginctl b/shell-completion/bash/loginctl index 7351212e0f6..9085d2dd5f5 100644 --- a/shell-completion/bash/loginctl +++ b/shell-completion/bash/loginctl @@ -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 } diff --git a/shell-completion/bash/machinectl b/shell-completion/bash/machinectl index d772bc6b0bb..7e837361141 100644 --- a/shell-completion/bash/machinectl +++ b/shell-completion/bash/machinectl @@ -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 } diff --git a/shell-completion/bash/portablectl b/shell-completion/bash/portablectl index 77a499593da..87c4a5ee4f7 100644 --- a/shell-completion/bash/portablectl +++ b/shell-completion/bash/portablectl @@ -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 } diff --git a/shell-completion/bash/run0 b/shell-completion/bash/run0 index 86253b826ae..80300cd9ab1 100644 --- a/shell-completion/bash/run0 +++ b/shell-completion/bash/run0 @@ -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 } diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in index 1e01521adc3..7bc5ddb8772 100644 --- a/shell-completion/bash/systemctl.in +++ b/shell-completion/bash/systemctl.in @@ -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 diff --git a/shell-completion/bash/systemd-analyze b/shell-completion/bash/systemd-analyze index d9c2ccd376c..e7844f92d9e 100644 --- a/shell-completion/bash/systemd-analyze +++ b/shell-completion/bash/systemd-analyze @@ -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; } } diff --git a/shell-completion/bash/systemd-cgls b/shell-completion/bash/systemd-cgls index 76f3ee3ab72..9c0393d045e 100644 --- a/shell-completion/bash/systemd-cgls +++ b/shell-completion/bash/systemd-cgls @@ -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 } diff --git a/shell-completion/bash/systemd-cgtop b/shell-completion/bash/systemd-cgtop index cdddb066951..41381bd24c3 100644 --- a/shell-completion/bash/systemd-cgtop +++ b/shell-completion/bash/systemd-cgtop @@ -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 } diff --git a/shell-completion/bash/systemd-creds b/shell-completion/bash/systemd-creds index 51b9db0d686..9a37a674b4d 100644 --- a/shell-completion/bash/systemd-creds +++ b/shell-completion/bash/systemd-creds @@ -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; } } diff --git a/shell-completion/bash/systemd-nspawn b/shell-completion/bash/systemd-nspawn index cff13b9e824..2a826204014 100644 --- a/shell-completion/bash/systemd-nspawn +++ b/shell-completion/bash/systemd-nspawn @@ -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 } diff --git a/shell-completion/bash/systemd-run b/shell-completion/bash/systemd-run index f6838edc08c..e1a14ff2b05 100644 --- a/shell-completion/bash/systemd-run +++ b/shell-completion/bash/systemd-run @@ -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 } diff --git a/shell-completion/bash/timedatectl b/shell-completion/bash/timedatectl index 3f4dfef35bf..14628822f61 100644 --- a/shell-completion/bash/timedatectl +++ b/shell-completion/bash/timedatectl @@ -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 } diff --git a/shell-completion/bash/udevadm b/shell-completion/bash/udevadm index 21fc6ed7c97..adb06a40ee3 100644 --- a/shell-completion/bash/udevadm +++ b/shell-completion/bash/udevadm @@ -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; } } diff --git a/shell-completion/zsh/_localectl b/shell-completion/zsh/_localectl index 25040517138..cb177d86518 100644 --- a/shell-completion/zsh/_localectl +++ b/shell-completion/zsh/_localectl @@ -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 diff --git a/shell-completion/zsh/_sd_machines b/shell-completion/zsh/_sd_machines index 6946f6faa20..a1c7de1b2c7 100644 --- a/shell-completion/zsh/_sd_machines +++ b/shell-completion/zsh/_sd_machines @@ -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 } diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in index e811803d208..a74cd8de398 100644 --- a/shell-completion/zsh/_systemctl.in +++ b/shell-completion/zsh/_systemctl.in @@ -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 diff --git a/shell-completion/zsh/_systemd-run b/shell-completion/zsh/_systemd-run index af867764380..e59e8ac6bd9 100644 --- a/shell-completion/zsh/_systemd-run +++ b/shell-completion/zsh/_systemd-run @@ -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] )) ||