mirror of
https://github.com/systemd/systemd
synced 2025-10-06 20:24:45 +02:00
Compare commits
11 Commits
7ebbe57ece
...
5b94f463f0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5b94f463f0 | ||
![]() |
c2b0f637c2 | ||
![]() |
86fff7fb38 | ||
![]() |
b371e7252c | ||
![]() |
01e769bc2e | ||
![]() |
cb2e0dc4f5 | ||
![]() |
12e64a4848 | ||
![]() |
5300aa7a1d | ||
![]() |
56c093004c | ||
![]() |
dfe6b3fa38 | ||
![]() |
2da41c4b51 |
@ -25,7 +25,7 @@ __contains_word () {
|
||||
}
|
||||
|
||||
__get_entry_ids() {
|
||||
bootctl --no-pager list 2>/dev/null | { while read -r a b; do [[ $a == 'id:' ]] && echo " $b"; done }
|
||||
bootctl --no-pager list 2>/dev/null | { while read -r a b; do [[ $a == 'id:' ]] && echo " $b"; done; }
|
||||
}
|
||||
|
||||
_bootctl() {
|
||||
@ -94,7 +94,7 @@ _bootctl() {
|
||||
if ! __contains_word "${COMP_WORDS[i]}" ${OPTS[*]} ${VERBS[*]} &&
|
||||
! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
|
||||
name=${COMP_WORDS[i]}
|
||||
break;
|
||||
break
|
||||
fi
|
||||
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 -r a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ __get_busnames() {
|
||||
local mode=$1
|
||||
local a b
|
||||
busctl $mode list --no-legend --no-pager --full 2>/dev/null |
|
||||
{ while read a b; do echo " $a"; done; };
|
||||
{ while read -r a b; do echo " $a"; done; }
|
||||
}
|
||||
|
||||
__get_objects() {
|
||||
@ -43,7 +43,7 @@ __get_objects() {
|
||||
local busname=$2
|
||||
local a b
|
||||
busctl $mode tree --list --no-legend --no-pager $busname 2>/dev/null |
|
||||
{ while read a b; do echo " $a"; done; };
|
||||
{ while read -r a b; do echo " $a"; done; }
|
||||
}
|
||||
|
||||
__get_interfaces() {
|
||||
@ -52,7 +52,7 @@ __get_interfaces() {
|
||||
local path=$3
|
||||
local a b c
|
||||
busctl $mode introspect --list --no-legend --no-pager $busname $path 2>/dev/null |
|
||||
{ while read a b c; do [[ "$b" == "interface" ]] && echo " $a"; done; };
|
||||
{ while read -r a b c; do [[ "$b" == "interface" ]] && echo " $a"; done; }
|
||||
}
|
||||
|
||||
__get_members() {
|
||||
@ -65,7 +65,7 @@ __get_members() {
|
||||
local a b c d e
|
||||
busctl $mode introspect --list --no-legend --no-pager $busname $path $interface 2>/dev/null |
|
||||
sed -e 's/^\.//' |
|
||||
{ while read a b c d e; do [[ "$b" == "$type" && ( -z $flags || "$e" == "$flags" ) ]] && echo " $a"; done; };
|
||||
{ while read -r a b c d e; do [[ "$b" == "$type" && ( -z $flags || "$e" == "$flags" ) ]] && echo " $a"; done; }
|
||||
}
|
||||
|
||||
__get_signature() {
|
||||
@ -76,7 +76,7 @@ __get_signature() {
|
||||
local member=$5
|
||||
local a b c d
|
||||
busctl $mode introspect --list --no-legend --no-pager $busname $path $interface 2>/dev/null |
|
||||
sed -e 's/^\.//' | { while read a b c d; do [[ "$a" == "$member" && "$c" != '-' ]] && echo " \"$c\""; done; };
|
||||
sed -e 's/^\.//' | { while read -r a b c d; do [[ "$a" == "$member" && "$c" != '-' ]] && echo " \"$c\""; done; }
|
||||
}
|
||||
|
||||
_busctl() {
|
||||
|
@ -27,7 +27,7 @@ __contains_word () {
|
||||
__get_machines() {
|
||||
local a b
|
||||
machinectl list --full --no-legend --no-pager 2>/dev/null |
|
||||
{ while read a b; do echo " $a"; done; };
|
||||
{ while read -r a b; do echo " $a"; done; }
|
||||
}
|
||||
|
||||
__get_homes() {
|
||||
|
@ -29,7 +29,7 @@ __contains_word () {
|
||||
__get_machines() {
|
||||
local a b
|
||||
machinectl list --full --no-legend --no-pager 2>/dev/null |
|
||||
{ while read a b; do echo " $a"; done; };
|
||||
{ while read -r a b; do echo " $a"; done; }
|
||||
}
|
||||
|
||||
_hostnamectl() {
|
||||
|
@ -26,8 +26,12 @@ __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 -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 -r a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ _journalctl() {
|
||||
if __contains_word "$prev" '>' '>>' '&>'; then
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $(compgen -f -- "$cur") )
|
||||
return 0;
|
||||
return 0
|
||||
fi
|
||||
|
||||
if __contains_word "$prev" ${OPTS[ARG]} ${OPTS[ARGUNKNOWN]}; then
|
||||
@ -81,7 +81,7 @@ _journalctl() {
|
||||
comps=$( journalctl --output=help 2>/dev/null )
|
||||
;;
|
||||
--field|-F)
|
||||
comps=$(journalctl --fields | sort 2>/dev/null)
|
||||
comps=$(journalctl --fields 2>/dev/null | sort)
|
||||
;;
|
||||
--machine|-M)
|
||||
comps=$( __get_machines )
|
||||
@ -95,9 +95,9 @@ _journalctl() {
|
||||
;;
|
||||
--unit|-u)
|
||||
if __contains_word "--user" ${COMP_WORDS[*]}; then
|
||||
comps=$(journalctl -F '_SYSTEMD_USER_UNIT' 2>/dev/null)
|
||||
comps=$(journalctl -F '_SYSTEMD_USER_UNIT' 2>/dev/null)
|
||||
else
|
||||
comps=$(journalctl -F '_SYSTEMD_UNIT' 2>/dev/null)
|
||||
comps=$(journalctl -F '_SYSTEMD_UNIT' 2>/dev/null)
|
||||
fi
|
||||
# Similarly to systemctl, we need to distinguish between
|
||||
# escaped and unescaped names in order to be able to correctly
|
||||
|
@ -36,11 +36,11 @@ _kernel_install() {
|
||||
comps="add remove"
|
||||
;;
|
||||
2)
|
||||
comps=$(cd /lib/modules; echo [0-9]*)
|
||||
comps=$(cd /lib/modules && echo [0-9]*)
|
||||
if [[ ${COMP_WORDS[1]} == "remove" ]] && [[ -f /etc/machine-id ]]; then
|
||||
read MACHINE_ID < /etc/machine-id
|
||||
read -r MACHINE_ID < /etc/machine-id
|
||||
if [[ $MACHINE_ID ]] && ( [[ -d /boot/$MACHINE_ID ]] || [[ -L /boot/$MACHINE_ID ]] ); then
|
||||
comps=$(cd "/boot/$MACHINE_ID"; echo [0-9]*)
|
||||
comps=$(cd "/boot/$MACHINE_ID" && echo [0-9]*)
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
@ -26,14 +26,14 @@ __contains_word () {
|
||||
done
|
||||
}
|
||||
|
||||
__get_all_sessions () { loginctl --no-legend list-sessions | { while read -r a b; do printf "%s\n" "$a"; done; } ; }
|
||||
__get_all_users () { loginctl --no-legend list-users | { while read -r a b; do printf "%s\n" "$b"; done; } ; }
|
||||
__get_all_seats () { loginctl --no-legend list-seats | { while read -r a b; do printf "%s\n" "$a"; done; } ; }
|
||||
__get_all_sessions () { loginctl --no-legend list-sessions 2>/dev/null | { while read -r a b; do printf "%s\n" "$a"; done; } ; }
|
||||
__get_all_users () { loginctl --no-legend list-users 2>/dev/null | { while read -r a b; do printf "%s\n" "$b"; done; } ; }
|
||||
__get_all_seats () { loginctl --no-legend list-seats 2>/dev/null | { while read -r a b; do printf "%s\n" "$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 -r 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 -r a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ __contains_word () {
|
||||
}
|
||||
|
||||
__get_links() {
|
||||
networkctl list --no-legend --no-pager --all --full | { while read -r a b c; do echo " $b"; done; };
|
||||
networkctl list --no-legend --no-pager --all --full 2>/dev/null | { while read -r a b c; do echo " $b"; done; }
|
||||
}
|
||||
|
||||
__get_links_with_prefix() {
|
||||
@ -70,7 +70,7 @@ _networkctl() {
|
||||
if __contains_word "$prev" ${OPTS[ARG]}; then
|
||||
case $prev in
|
||||
--json)
|
||||
comps=$(networkctl --json=help)
|
||||
comps=$(networkctl --json=help 2>/dev/null)
|
||||
;;
|
||||
*)
|
||||
return 0
|
||||
|
@ -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 -r a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ _resolvectl() {
|
||||
comps=$( __get_interfaces )
|
||||
;;
|
||||
--protocol|-p|--type|-t|--class|-c|--json)
|
||||
comps=$( resolvectl --legend=no "$prev" help; echo help )
|
||||
comps=$( resolvectl --legend=no "$prev" help 2>/dev/null; echo help )
|
||||
;;
|
||||
--raw)
|
||||
comps="payload packet"
|
||||
@ -107,7 +107,7 @@ _resolvectl() {
|
||||
if __contains_word "${COMP_WORDS[i]}" ${ARGS[FAMILY]} &&
|
||||
! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
|
||||
name=${COMP_WORDS[i]}
|
||||
break;
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [[ -z $name ]]; then
|
||||
@ -122,7 +122,7 @@ _resolvectl() {
|
||||
if __contains_word "${COMP_WORDS[i]}" $interfaces &&
|
||||
! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
|
||||
name=${COMP_WORDS[i]}
|
||||
break;
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
@ -135,7 +135,7 @@ _resolvectl() {
|
||||
if __contains_word "${COMP_WORDS[i]}" ${ARGS[RESOLVE]} &&
|
||||
! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
|
||||
name=${COMP_WORDS[i]}
|
||||
break;
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
@ -151,7 +151,7 @@ _resolvectl() {
|
||||
if __contains_word "${COMP_WORDS[i]}" ${ARGS[BOOLEAN]} &&
|
||||
! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
|
||||
name=${COMP_WORDS[i]}
|
||||
break;
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
@ -167,7 +167,7 @@ _resolvectl() {
|
||||
if __contains_word "${COMP_WORDS[i]}" ${ARGS[DNSSEC]} &&
|
||||
! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
|
||||
name=${COMP_WORDS[i]}
|
||||
break;
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
@ -183,7 +183,7 @@ _resolvectl() {
|
||||
if __contains_word "${COMP_WORDS[i]}" ${ARGS[DNSOVERTLS]} &&
|
||||
! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
|
||||
name=${COMP_WORDS[i]}
|
||||
break;
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -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 2>/dev/null |
|
||||
{ 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 -r a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ __systemctl() {
|
||||
}
|
||||
|
||||
__systemd_properties() {
|
||||
{{LIBEXECDIR}}/systemd --dump-bus-properties
|
||||
{{LIBEXECDIR}}/systemd --dump-bus-properties 2>/dev/null
|
||||
}
|
||||
|
||||
__contains_word () {
|
||||
@ -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,20 +107,20 @@ __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() {
|
||||
local a
|
||||
|
||||
while read a _; do
|
||||
while read -r a _; do
|
||||
echo " $a"
|
||||
done < <(machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null | sort -u; echo ".host")
|
||||
}
|
||||
@ -291,13 +291,13 @@ _systemctl () {
|
||||
compopt -o filenames
|
||||
|
||||
elif __contains_word "$verb" ${VERBS[DISABLED_UNITS]}; then
|
||||
comps=$( __get_disabled_units $mode "$cur";
|
||||
comps=$( __get_disabled_units $mode "$cur"
|
||||
__get_template_names $mode "$cur")
|
||||
compopt -o filenames
|
||||
|
||||
elif __contains_word "$verb" ${VERBS[REENABLABLE_UNITS]}; then
|
||||
comps=$( __get_disabled_units $mode "$cur";
|
||||
__get_enabled_units $mode "$cur";
|
||||
comps=$( __get_disabled_units $mode "$cur"
|
||||
__get_enabled_units $mode "$cur"
|
||||
__get_template_names $mode "$cur")
|
||||
compopt -o filenames
|
||||
|
||||
@ -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,24 +28,24 @@ __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 -r a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
__get_units_all() {
|
||||
systemctl list-units --no-legend --no-pager --plain --all $1 | \
|
||||
{ while read -r a b c; do echo " $a"; done }
|
||||
systemctl list-units --no-legend --no-pager --plain --all $1 2>/dev/null |
|
||||
{ while read -r a b c; do echo " $a"; done; }
|
||||
}
|
||||
|
||||
__get_services() {
|
||||
systemctl list-units --no-legend --no-pager --plain -t service --all $1 | \
|
||||
{ while read -r a b c; do [[ $b == "loaded" ]]; echo " $a"; done }
|
||||
systemctl list-units --no-legend --no-pager --plain -t service --all $1 2>/dev/null |
|
||||
{ while read -r a b c; do [[ $b == "loaded" ]] && echo " $a"; done; }
|
||||
}
|
||||
|
||||
__get_syscall_sets() {
|
||||
local line
|
||||
systemd-analyze syscall-filter --no-pager | while IFS= read -r line; do
|
||||
systemd-analyze syscall-filter --no-pager 2>/dev/null | while IFS= read -r line; do
|
||||
if [[ $line == @* ]]; then
|
||||
printf '%s\n' "$line"
|
||||
fi
|
||||
@ -53,7 +53,7 @@ __get_syscall_sets() {
|
||||
}
|
||||
|
||||
__get_architectures() {
|
||||
systemd-analyze --no-legend --no-pager architectures | { while read -r a b; do echo " $a"; done }
|
||||
systemd-analyze --no-legend --no-pager architectures 2>/dev/null | { while read -r a b; do echo " $a"; done; }
|
||||
}
|
||||
|
||||
_systemd_analyze() {
|
||||
@ -163,7 +163,7 @@ _systemd_analyze() {
|
||||
if [[ $cur = -* ]]; then
|
||||
comps='--help --version --system --user --global --man=no --generators=yes --root --image --recursive-errors=no --recursive-errors=yes --recursive-errors=one'
|
||||
else
|
||||
comps=$( compgen -A file -- "$cur";
|
||||
comps=$( compgen -A file -- "$cur"
|
||||
__get_units_all $mode )
|
||||
compopt -o filenames
|
||||
fi
|
||||
|
@ -26,17 +26,17 @@ __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 -r a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
__get_units_have_cgroup() {
|
||||
systemctl $1 --full --no-legend --no-pager --plain list-units | {
|
||||
systemctl $1 --full --no-legend --no-pager --plain list-units 2>/dev/null | {
|
||||
while read -r a b c d; do
|
||||
[[ $c == "active" && ${a##*.} =~ (service|socket|mount|swap|slice|scope) ]] && echo " $a"
|
||||
done
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
_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 -r a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
@ -26,15 +26,15 @@ __contains_word() {
|
||||
|
||||
__get_tpm2_devices() {
|
||||
local a b c
|
||||
systemd-creds --no-legend --quiet --tpm2-device=list 2>/dev/null | \
|
||||
{ while read -r a b c; do echo " $a"; done }
|
||||
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 | \
|
||||
{ while read -r a b c; do echo " $a"; done }
|
||||
systemd-creds list $mode --no-legend --no-pager $1 2>/dev/null |
|
||||
{ while read -r a b c; do echo " $a"; done; }
|
||||
}
|
||||
|
||||
_systemd_creds() {
|
||||
|
@ -26,24 +26,26 @@ __contains_word() {
|
||||
|
||||
__get_users() {
|
||||
local a b
|
||||
loginctl list-users --no-legend --no-pager | { while read a b; do echo " $b"; done; };
|
||||
loginctl list-users --no-legend --no-pager 2>/dev/null |
|
||||
{ while read -r a b; do echo " $b"; done; }
|
||||
}
|
||||
|
||||
__get_slices() {
|
||||
local a b
|
||||
systemctl list-units -t slice --no-legend --no-pager --plain | { while read a b; do echo " $a"; done; };
|
||||
systemctl list-units -t slice --no-legend --no-pager --plain 2>/dev/null |
|
||||
{ while read -r a b; 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 -r a b; do echo " $a"; done; } |
|
||||
sort -u
|
||||
}
|
||||
|
||||
__get_env() {
|
||||
local a
|
||||
env | { while read a; do echo " ${a%%=*}"; done; };
|
||||
env | { while read -r a; do [[ $a =~ ^[A-Za-z0-9_]+= ]] && echo " ${a%%=*}"; done; }
|
||||
}
|
||||
|
||||
__get_interfaces(){
|
||||
|
@ -26,7 +26,7 @@ __contains_word () {
|
||||
}
|
||||
|
||||
__get_names() {
|
||||
systemd-path | { while IFS=: read -r a b; do echo " $a"; done; }
|
||||
systemd-path 2>/dev/null | { while IFS=: read -r a b; do echo " $a"; done; }
|
||||
}
|
||||
|
||||
_systemd_path() {
|
||||
|
@ -50,7 +50,7 @@ _systemd-resolve() {
|
||||
comps=$( __get_interfaces )
|
||||
;;
|
||||
--protocol|-p|--type|-t|--class|-c)
|
||||
comps=$( systemd-resolve --legend=no "$prev" help; echo help )
|
||||
comps=$( systemd-resolve --legend=no "$prev" help 2>/dev/null; echo help )
|
||||
;;
|
||||
--raw)
|
||||
comps="payload packet"
|
||||
|
@ -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 2>/dev/null |
|
||||
{ while read -r a b c d; do echo " $a"; done; }; }
|
||||
|
||||
__get_properties () {
|
||||
systemd-analyze transient-settings scope service 2>/dev/null |
|
||||
@ -31,7 +31,7 @@ __get_properties () {
|
||||
}
|
||||
|
||||
__get_path_properties () {
|
||||
systemd-analyze transient-settings path |
|
||||
systemd-analyze transient-settings path 2>/dev/null |
|
||||
while read -r p; do [ -z "$p" ] || echo "$p="; done
|
||||
}
|
||||
|
||||
@ -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 -r 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; }
|
||||
}
|
||||
|
||||
@ -51,12 +51,12 @@ __get_root() {
|
||||
|
||||
for ((i=0; i < COMP_CWORD; i++)); do
|
||||
if [[ "${COMP_WORDS[i]}" = --root=* ]]; then
|
||||
echo "${COMP_WORDS[i]#--root=}"
|
||||
break
|
||||
echo "${COMP_WORDS[i]#--root=}"
|
||||
break
|
||||
fi
|
||||
if (( i > 0 )) && [[ "${COMP_WORDS[i-1]}" == "--root" ]]; then
|
||||
echo "${COMP_WORDS[i]}"
|
||||
break
|
||||
echo "${COMP_WORDS[i]}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -28,12 +28,12 @@ __contains_word () {
|
||||
|
||||
__get_all_users () {
|
||||
local a b
|
||||
userdbctl user --no-legend -B | { while read -r a b; do printf "%s\n" "$a"; done; }
|
||||
userdbctl user --no-legend -B 2>/dev/null | { while read -r a b; do printf "%s\n" "$a"; done; }
|
||||
}
|
||||
|
||||
__get_all_groups () {
|
||||
local a b
|
||||
userdbctl group --no-legend -B | { while read -r a b; do printf "%s\n" "$a"; done; }
|
||||
userdbctl group --no-legend -B 2>/dev/null | { while read -r a b; do printf "%s\n" "$a"; done; }
|
||||
}
|
||||
|
||||
_userdbctl () {
|
||||
|
@ -8,7 +8,7 @@ __bootctl() {
|
||||
_bootctl_comp_ids() {
|
||||
local expl
|
||||
local -a ids
|
||||
__bootctl list | while read a b; do
|
||||
__bootctl list | while read -r a b; do
|
||||
if [[ "$a" == "id:" ]]; then
|
||||
ids+="$b"
|
||||
fi
|
||||
@ -32,7 +32,7 @@ _bootctl_reboot-to-firmware() {
|
||||
local -a _completions
|
||||
_completions=( yes no )
|
||||
typeset -U _completions
|
||||
_describe 'possible values' _completions
|
||||
_describe 'possible values' _completions
|
||||
}
|
||||
|
||||
(( $+functions[_bootctl_commands] )) || _bootctl_commands()
|
||||
|
@ -87,7 +87,7 @@ __dbus_matchspec() {
|
||||
local -a bus_names
|
||||
local NAME OTHER
|
||||
__busctl --unique list |
|
||||
while read NAME OTHER; do
|
||||
while read -r NAME OTHER; do
|
||||
echo $NAME
|
||||
done
|
||||
}
|
||||
@ -104,7 +104,7 @@ __dbus_matchspec() {
|
||||
{
|
||||
local NAME TYPE OTHER
|
||||
__busctl introspect "$1" "$2" |
|
||||
while read NAME TYPE OTHER; do
|
||||
while read -r NAME TYPE OTHER; do
|
||||
if [[ ${TYPE} == "interface" ]]; then
|
||||
echo ${NAME}
|
||||
fi
|
||||
@ -117,7 +117,7 @@ __dbus_matchspec() {
|
||||
local required="$5"
|
||||
local NAME TYPE SIGNATURE VALUE FLAGS
|
||||
__busctl introspect "$1" "$2" "$3" |
|
||||
while read NAME TYPE SIGNATURE VALUE FLAGS; do
|
||||
while read -r NAME TYPE SIGNATURE VALUE FLAGS; do
|
||||
[[ -z "$member" || ${TYPE} == "$member" ]] &&
|
||||
[[ -z "$required" || "${${(os: :)FLAGS}}" == $~required ]] &&
|
||||
echo ${NAME#.}
|
||||
@ -128,7 +128,7 @@ __dbus_matchspec() {
|
||||
{
|
||||
local NAME TYPE SIGNATURE VALUE FLAGS
|
||||
__busctl introspect "$1" "$2" "$3" |
|
||||
while read NAME TYPE SIGNATURE VALUE FLAGS; do
|
||||
while read -r NAME TYPE SIGNATURE VALUE FLAGS; do
|
||||
if [[ ${NAME#.} == "$4" ]]; then
|
||||
[[ ${SIGNATURE} != "-" ]] && echo ${SIGNATURE}
|
||||
fi
|
||||
|
@ -17,7 +17,7 @@ _coredumpctl_commands(){
|
||||
local -a _dumps
|
||||
cmd="${${_coredumpctl_cmds[(r)$words[1]:*]%%:*}}"
|
||||
if (( $#cmd )); then
|
||||
_dumps=( "${(f)$(coredumpctl list -q --no-legend | awk 'BEGIN{OFS=":"} {sub(/[[ \t]+/, ""); print $4,$0}' 2>/dev/null)}" )
|
||||
_dumps=( "${(f)$(coredumpctl list -q --no-legend 2>/dev/null | awk 'BEGIN{OFS=":"} {sub(/[[ \t]+/, ""); print $4,$0}')}" )
|
||||
if [[ -n "$_dumps" ]]; then
|
||||
_describe -V -t pids 'coredumps' _dumps
|
||||
else
|
||||
|
@ -48,26 +48,26 @@ _journalctl_field_values() {
|
||||
|
||||
(( $+functions[_journalctl_boots] )) ||
|
||||
_journalctl_boots() {
|
||||
local -a _bootid _previousboots
|
||||
_bootid=( ${(f)"$(_call_program bootid "$service -F _BOOT_ID")"} )
|
||||
_previousboots=( -{1..${#_bootid}} )
|
||||
_alternative : \
|
||||
"offsets:boot offsets:compadd -a '_previousboots[1,-2]'" \
|
||||
"bootid:boot ids:compadd -a _bootid"
|
||||
local -a _bootid _previousboots
|
||||
_bootid=( ${(f)"$(_call_program bootid "$service -F _BOOT_ID")"} )
|
||||
_previousboots=( -{1..${#_bootid}} )
|
||||
_alternative : \
|
||||
"offsets:boot offsets:compadd -a '_previousboots[1,-2]'" \
|
||||
"bootid:boot ids:compadd -a _bootid"
|
||||
}
|
||||
|
||||
(( $+functions[_journalctl_facilities] )) ||
|
||||
_journalctl_facilities() {
|
||||
local -a _journalctl_facilities
|
||||
_journalctl_facilities=(help kern user mail daemon auth syslog lpr news uucp cron authpriv ftp local0 local1 local2 local3 local4 local5 local6 local7)
|
||||
_describe 'possible values' _journalctl_facilities
|
||||
local -a _journalctl_facilities
|
||||
_journalctl_facilities=(help kern user mail daemon auth syslog lpr news uucp cron authpriv ftp local0 local1 local2 local3 local4 local5 local6 local7)
|
||||
_describe 'possible values' _journalctl_facilities
|
||||
}
|
||||
|
||||
(( $+functions[_journalctl_namespaces] )) ||
|
||||
_journalctl_namespaces() {
|
||||
local -a _journalctl_namespaces
|
||||
_journalctl_namespaces=( ${(f)"$(_call_program namespaces "$service --list-namespaces --output=cat" 2>/dev/null)"} )
|
||||
_describe 'possible values' _journalctl_namespaces
|
||||
local -a _journalctl_namespaces
|
||||
_journalctl_namespaces=( ${(f)"$(_call_program namespaces "$service --list-namespaces --output=cat" 2>/dev/null)"} )
|
||||
_describe 'possible values' _journalctl_namespaces
|
||||
}
|
||||
|
||||
# Build arguments for "journalctl" to be used in completion.
|
||||
|
@ -12,7 +12,7 @@ _kernel-install_images(){
|
||||
|
||||
(( $+functions[_kernel-install_kernels] )) ||
|
||||
_kernel-install_kernels(){
|
||||
read _MACHINE_ID < /etc/machine-id
|
||||
read -r _MACHINE_ID < /etc/machine-id
|
||||
_kernel=( /lib/modules/[0-9]* )
|
||||
if [[ "$cmd" == "remove" && -n "$_MACHINE_ID" ]]; then
|
||||
_kernel=( "/boot/$_MACHINE_ID"/[0-9]* )
|
||||
|
@ -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
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
(( $+functions[_loginctl_all_sessions] )) ||
|
||||
_loginctl_all_sessions() {
|
||||
local session description
|
||||
loginctl --no-legend list-sessions | while read -r session description; do
|
||||
loginctl --no-legend list-sessions 2>/dev/null | while read -r session description; do
|
||||
_sys_all_sessions+=( "$session" )
|
||||
_sys_all_sessions_descr+=( "${session}:$description" )
|
||||
done
|
||||
@ -13,7 +13,7 @@ _loginctl_all_sessions() {
|
||||
(( $+functions[_loginctl_all_users] )) ||
|
||||
_loginctl_all_users() {
|
||||
local uid description
|
||||
loginctl --no-legend list-users | while read -r uid description; do
|
||||
loginctl --no-legend list-users 2>/dev/null | while read -r uid description; do
|
||||
_sys_all_users+=( "$uid" )
|
||||
_sys_all_users_descr+=( "${uid}:$description" )
|
||||
done
|
||||
@ -22,7 +22,7 @@ _loginctl_all_users() {
|
||||
(( $+functions[_loginctl_all_seats] )) ||
|
||||
_loginctl_all_seats() {
|
||||
local seat description
|
||||
loginctl --no-legend list-seats | while read -r seat description; do
|
||||
loginctl --no-legend list-seats 2>/dev/null | while read -r seat description; do
|
||||
_sys_all_seats+=( "$seat" )
|
||||
_sys_all_seats_descr+=( "${seat}:$description" )
|
||||
done
|
||||
@ -35,8 +35,8 @@ for fun in session-status show-session activate lock-session unlock-session term
|
||||
_loginctl_$fun() {
|
||||
local -a _sys_all_sessions{,_descr}
|
||||
|
||||
_sys_all_sessions=( "self" )
|
||||
_sys_all_sessions_descr=( "self:alias for the current session" )
|
||||
_sys_all_sessions=( "self" )
|
||||
_sys_all_sessions_descr=( "self:alias for the current session" )
|
||||
|
||||
_loginctl_all_sessions
|
||||
for _ignore in $words[2,-1]; do
|
||||
@ -84,8 +84,8 @@ done
|
||||
_loginctl_seats() {
|
||||
local -a _sys_all_seats{,_descr}
|
||||
|
||||
_sys_all_seats=( "self" )
|
||||
_sys_all_seats_descr=( "self:alias for the current seat" )
|
||||
_sys_all_seats=( "self" )
|
||||
_sys_all_seats_descr=( "self:alias for the current seat" )
|
||||
|
||||
_loginctl_all_seats
|
||||
for _ignore in $words[2,-1]; do
|
||||
|
@ -5,7 +5,7 @@
|
||||
__machinectl_get_images () {
|
||||
local -a flags
|
||||
if [[ $PREFIX == .* ]]; then flags=( --all ); fi
|
||||
machinectl --no-legend list-images $flags | {while read -r a b; do
|
||||
machinectl --no-legend list-images $flags 2>/dev/null | {while read -r a b; do
|
||||
# escape : and \; do not interpret existing escape sequences
|
||||
printf -- "%s\n" ${a//(#b)(\\|:)/\\$match}
|
||||
done;}
|
||||
|
@ -19,56 +19,56 @@
|
||||
(( $+functions[_resolvectl_protocols] )) ||
|
||||
_resolvectl_protocols() {
|
||||
local -a _protocol
|
||||
_protocol=( $(_call_program protocol ${service} --legend=no --protocol help; echo help) )
|
||||
_protocol=( $(_call_program protocol ${service} --legend=no --protocol help 2>/dev/null; echo help) )
|
||||
_values 'protocol' "$_protocol[@]"
|
||||
}
|
||||
|
||||
(( $+functions[_resolvectl_types] )) ||
|
||||
_resolvectl_types() {
|
||||
local -a _type
|
||||
_type=( $(_call_program type ${service} --legend=no --type help; echo help) )
|
||||
_type=( $(_call_program type ${service} --legend=no --type help 2>/dev/null; echo help) )
|
||||
_values 'type' "$_type[@]"
|
||||
}
|
||||
|
||||
(( $+functions[_resolvectl_classes] )) ||
|
||||
_resolvectl_classes() {
|
||||
local -a _class
|
||||
_class=( $(_call_program class ${service} --legend=no --class help; echo help) )
|
||||
_class=( $(_call_program class ${service} --legend=no --class help 2>/dev/null; echo help) )
|
||||
_values 'class' "$_class[@]"
|
||||
}
|
||||
|
||||
(( $+functions[_resolvectl_commands] )) ||
|
||||
_resolvectl_commands() {
|
||||
local -a _resolvectl_cmds
|
||||
_resolvectl_cmds=(
|
||||
default-route:"Configure per-interface default-route setting"
|
||||
dns:"Configure per-interface DNS configuration"
|
||||
dnsovertls:"Configure per-interface dnsovertls enabled status"
|
||||
dnssec:"Configure per-interface dnssec enabled status"
|
||||
domain:"Configure per-interface search and route-only domains"
|
||||
flush-caches:"Flushes all DNS resource record caches the service maintains locally"
|
||||
llmnr:"Configure per-interface llmnr enabled status"
|
||||
log-level:"Get/set logging threshold for systemd-resolved"
|
||||
mdns:"Configure per-interface mdns enabled status"
|
||||
monitor:"Monitor DNS queries"
|
||||
nta:"Configure per-interface nta domains"
|
||||
openpgp:"Retrieve openpgp keys for an email"
|
||||
query:"Resolve domain names, IPv4 and IPv6 addresses"
|
||||
reset-server-features:"Flushes all feature level information the resolver has learned about specific servers"
|
||||
reset-statistics:"Resets the statistics counter shown in statistics to zero"
|
||||
revert:"Revert the per-interfce DNS configuration"
|
||||
service:"Resolve DNS-SD and SRV services"
|
||||
show-cache:"Show the current cache contents"
|
||||
show-server-state:"Show servers state"
|
||||
statistics:"Show resolver statistics"
|
||||
status:"Show the global and per-link DNS settings currently in effect"
|
||||
tlsa:"Query tlsa public keys stored as TLSA resource records"
|
||||
)
|
||||
local -a _resolvectl_cmds
|
||||
_resolvectl_cmds=(
|
||||
default-route:"Configure per-interface default-route setting"
|
||||
dns:"Configure per-interface DNS configuration"
|
||||
dnsovertls:"Configure per-interface dnsovertls enabled status"
|
||||
dnssec:"Configure per-interface dnssec enabled status"
|
||||
domain:"Configure per-interface search and route-only domains"
|
||||
flush-caches:"Flushes all DNS resource record caches the service maintains locally"
|
||||
llmnr:"Configure per-interface llmnr enabled status"
|
||||
log-level:"Get/set logging threshold for systemd-resolved"
|
||||
mdns:"Configure per-interface mdns enabled status"
|
||||
monitor:"Monitor DNS queries"
|
||||
nta:"Configure per-interface nta domains"
|
||||
openpgp:"Retrieve openpgp keys for an email"
|
||||
query:"Resolve domain names, IPv4 and IPv6 addresses"
|
||||
reset-server-features:"Flushes all feature level information the resolver has learned about specific servers"
|
||||
reset-statistics:"Resets the statistics counter shown in statistics to zero"
|
||||
revert:"Revert the per-interfce DNS configuration"
|
||||
service:"Resolve DNS-SD and SRV services"
|
||||
show-cache:"Show the current cache contents"
|
||||
show-server-state:"Show servers state"
|
||||
statistics:"Show resolver statistics"
|
||||
status:"Show the global and per-link DNS settings currently in effect"
|
||||
tlsa:"Query tlsa public keys stored as TLSA resource records"
|
||||
)
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands 'resolvectl commands' _resolvectl_cmds
|
||||
fi
|
||||
}
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands 'resolvectl commands' _resolvectl_cmds
|
||||
fi
|
||||
}
|
||||
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[Print a short help text and exit]' \
|
||||
|
@ -2,56 +2,56 @@
|
||||
|
||||
(( $+functions[_run0_unit_properties] )) ||
|
||||
_run0_unit_properties() {
|
||||
local -a props=(
|
||||
BlockIOAccounting BlockIODeviceWeight BlockIOReadBandwidth
|
||||
BlockIOWeight BlockIOWriteBandwidth CPUAccounting
|
||||
CPUShares DeviceAllow DevicePolicy
|
||||
Environment EnvironmentFile ExitType
|
||||
FinalKillSignal Group InaccessiblePaths
|
||||
KillMode KillSignal LimitAS
|
||||
LimitCORE LimitCPU LimitDATA
|
||||
LimitFSIZE LimitLOCKS LimitMEMLOCK
|
||||
LimitMSGQUEUE LimitNICE LimitNOFILE
|
||||
LimitNPROC LimitRSS LimitRTPRIO
|
||||
LimitRTTIME LimitSIGPENDING LimitSTACK
|
||||
MemoryAccounting MemoryLimit Nice
|
||||
NoNewPrivileges OOMScoreAdjust PassEnvironment
|
||||
PrivateDevices PrivateNetwork PrivateTmp
|
||||
ProtectHome ProtectSystem ReadOnlyPaths
|
||||
ReadWritePaths RestartKillSignal RootDirectory
|
||||
RuntimeDirectory SendSIGHUP SendSIGKILL
|
||||
SyslogFacility SyslogIdentifier SyslogLevel
|
||||
SyslogLevelPrefix TTYPath TimerSlackNSec
|
||||
User WorkingDirectory
|
||||
)
|
||||
_values -S= 'properties' ${^props}'::()'
|
||||
local -a props=(
|
||||
BlockIOAccounting BlockIODeviceWeight BlockIOReadBandwidth
|
||||
BlockIOWeight BlockIOWriteBandwidth CPUAccounting
|
||||
CPUShares DeviceAllow DevicePolicy
|
||||
Environment EnvironmentFile ExitType
|
||||
FinalKillSignal Group InaccessiblePaths
|
||||
KillMode KillSignal LimitAS
|
||||
LimitCORE LimitCPU LimitDATA
|
||||
LimitFSIZE LimitLOCKS LimitMEMLOCK
|
||||
LimitMSGQUEUE LimitNICE LimitNOFILE
|
||||
LimitNPROC LimitRSS LimitRTPRIO
|
||||
LimitRTTIME LimitSIGPENDING LimitSTACK
|
||||
MemoryAccounting MemoryLimit Nice
|
||||
NoNewPrivileges OOMScoreAdjust PassEnvironment
|
||||
PrivateDevices PrivateNetwork PrivateTmp
|
||||
ProtectHome ProtectSystem ReadOnlyPaths
|
||||
ReadWritePaths RestartKillSignal RootDirectory
|
||||
RuntimeDirectory SendSIGHUP SendSIGKILL
|
||||
SyslogFacility SyslogIdentifier SyslogLevel
|
||||
SyslogLevelPrefix TTYPath TimerSlackNSec
|
||||
User WorkingDirectory
|
||||
)
|
||||
_values -S= 'properties' ${^props}'::()'
|
||||
}
|
||||
|
||||
(( $+functions[_run0_slices] )) ||
|
||||
_run0_slices() {
|
||||
local -a slices=(
|
||||
${(@f)"$(_call_program slice-units systemctl --no-pager --legend=no --plain list-units --all -t slice 2>/dev/null)"}
|
||||
)
|
||||
slices=( ${slices%% *} )
|
||||
_describe -t slice-units 'slice unit' slices
|
||||
local -a slices=(
|
||||
${(@f)"$(_call_program slice-units systemctl --no-pager --legend=no --plain list-units --all -t slice 2>/dev/null)"}
|
||||
)
|
||||
slices=( ${slices%% *} )
|
||||
_describe -t slice-units 'slice unit' slices
|
||||
}
|
||||
|
||||
local -a args=(
|
||||
'--no-ask-password[Do not query the user for authentication]'
|
||||
'--unit=[Use this unit name instead of an automatically generated one]'
|
||||
{--property=,-p+}'[Sets a property on the service unit created]:property:_run0_unit_properties'
|
||||
'--description=[Provide a description for the service unit]'
|
||||
'--slice=[Make the new .service unit part of the specified slice]:slice unit:_run0_slices'
|
||||
'--slice-inherit[Make the new service unit part of the current slice]'
|
||||
{--user=,-u+}'[Switch to the specified user]:user:_users'
|
||||
{--group=,-g+}'[Switch to the specified group]:group:_groups'
|
||||
'--nice=[Run with specified nice level]:nice value'
|
||||
{--chdir=,-D+}'[Run within the specified working directory]:directory:_files -/'
|
||||
'--setenv=[Set the specified environment variable in the session]:environment variable:_parameters -g "*export*" -S = -q'
|
||||
'--background=[Change the terminal background color to the specified ANSI color]:ansi color'
|
||||
'--machine=[Execute the operation on a local container]:machine:_sd_machines'
|
||||
{-h,--help}'[Show the help text and exit]'
|
||||
'--version[Print a short version string and exit]'
|
||||
'--no-ask-password[Do not query the user for authentication]'
|
||||
'--unit=[Use this unit name instead of an automatically generated one]'
|
||||
{--property=,-p+}'[Sets a property on the service unit created]:property:_run0_unit_properties'
|
||||
'--description=[Provide a description for the service unit]'
|
||||
'--slice=[Make the new .service unit part of the specified slice]:slice unit:_run0_slices'
|
||||
'--slice-inherit[Make the new service unit part of the current slice]'
|
||||
{--user=,-u+}'[Switch to the specified user]:user:_users'
|
||||
{--group=,-g+}'[Switch to the specified group]:group:_groups'
|
||||
'--nice=[Run with specified nice level]:nice value'
|
||||
{--chdir=,-D+}'[Run within the specified working directory]:directory:_files -/'
|
||||
'--setenv=[Set the specified environment variable in the session]:environment variable:_parameters -g "*export*" -S = -q'
|
||||
'--background=[Change the terminal background color to the specified ANSI color]:ansi color'
|
||||
'--machine=[Execute the operation on a local container]:machine:_sd_machines'
|
||||
{-h,--help}'[Show the help text and exit]'
|
||||
'--version[Print a short version string and exit]'
|
||||
)
|
||||
|
||||
_arguments -S $args '*:: :{_normal -p $service}'
|
||||
|
@ -3,10 +3,9 @@
|
||||
|
||||
(( $+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; } | \
|
||||
sort -u
|
||||
{ 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
|
||||
}
|
||||
|
||||
local -a _machines
|
||||
|
@ -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
|
||||
@ -162,7 +162,7 @@ __systemctl()
|
||||
(( $+functions[_systemctl_all_units] )) ||
|
||||
_systemctl_all_units()
|
||||
{
|
||||
if _cache_invalid SYS_ALL_UNITS$_sys_service_mgr || ! _retrieve_cache SYS_ALL_UNITS$_sys_service_mgr;
|
||||
if _cache_invalid SYS_ALL_UNITS$_sys_service_mgr || ! _retrieve_cache SYS_ALL_UNITS$_sys_service_mgr
|
||||
then
|
||||
_sys_all_units=( ${${(f)"$(__systemctl list-units --all)"}%% *} )
|
||||
_store_cache SYS_ALL_UNITS$_sys_service_mgr _sys_all_units
|
||||
@ -173,9 +173,9 @@ __systemctl()
|
||||
(( $+functions[_systemctl_really_all_units] )) ||
|
||||
_systemctl_really_all_units()
|
||||
{
|
||||
local -a all_unit_files;
|
||||
local -a really_all_units;
|
||||
if _cache_invalid SYS_REALLY_ALL_UNITS$_sys_service_mgr || ! _retrieve_cache SYS_REALLY_ALL_UNITS$_sys_service_mgr;
|
||||
local -a all_unit_files
|
||||
local -a really_all_units
|
||||
if _cache_invalid SYS_REALLY_ALL_UNITS$_sys_service_mgr || ! _retrieve_cache SYS_REALLY_ALL_UNITS$_sys_service_mgr
|
||||
then
|
||||
all_unit_files=( ${${(f)"$(__systemctl list-unit-files)"}%% *} )
|
||||
_systemctl_all_units
|
||||
@ -473,9 +473,9 @@ done
|
||||
|
||||
(( $+functions[_systemctl_unit_properties] )) ||
|
||||
_systemctl_unit_properties() {
|
||||
local -a _sys_all_properties=( ${(f)"$({{LIBEXECDIR}}/systemd --no-pager --dump-bus-properties 2>/dev/null)"} )
|
||||
local -a _sys_all_properties=( ${(f)"$({{LIBEXECDIR}}/systemd --no-pager --dump-bus-properties 2>/dev/null)"} )
|
||||
_wanted systemd-unit-properties expl 'unit property' \
|
||||
_values -s , "${_sys_all_properties[@]}"
|
||||
_values -s , "${_sys_all_properties[@]}"
|
||||
}
|
||||
|
||||
(( $+functions[_systemctl_job_modes] )) ||
|
||||
|
@ -34,7 +34,7 @@ case "$service" in
|
||||
systemd-cgtop)
|
||||
_arguments \
|
||||
'(-)'{-h,--help}'[Show this help]' \
|
||||
'(-)--version[Print version and exit]' \
|
||||
'(-)--version[Print version and exit]' \
|
||||
'(-c -m -i -t)-p[Order by path]' \
|
||||
'(-c -p -m -i)-t[Order by number of tasks]' \
|
||||
'(-m -p -i -t)-c[Order by CPU load]' \
|
||||
@ -48,7 +48,7 @@ case "$service" in
|
||||
systemd-detect-virt)
|
||||
_arguments \
|
||||
'(-)'{-h,--help}'[Show this help]' \
|
||||
'(-)--version[Show package version]' \
|
||||
'(-)--version[Show package version]' \
|
||||
'(-c --container)'{-c,--container}'[Only detect whether we are run in a container]' \
|
||||
'(-v --vm)'{-v,--vm}'[Only detect whether we are run in a VM]' \
|
||||
'(-q --quiet)'{-q,--quiet}"[Don't output anything, just set return value]"
|
||||
@ -56,12 +56,12 @@ case "$service" in
|
||||
systemd-machine-id-setup)
|
||||
_arguments \
|
||||
'(-)'{-h,--help}'[Show this help]' \
|
||||
'(-)--version[Show package version]'
|
||||
'(-)--version[Show package version]'
|
||||
;;
|
||||
systemd-notify)
|
||||
_arguments \
|
||||
'(-)'{-h,--help}'[Show this help]' \
|
||||
'(-)--version[Show package version]' \
|
||||
'(-)--version[Show package version]' \
|
||||
'--ready[Inform the init system about service start-up completion.]' \
|
||||
'--pid=[Inform the init system about the main PID of the daemon]:daemon main PID:_pids' \
|
||||
'--status=[Send a free-form status string for the daemon to the init systemd]:status string:' \
|
||||
@ -70,8 +70,8 @@ case "$service" in
|
||||
systemd-tty-ask-password-agent)
|
||||
_arguments \
|
||||
'(-)'{-h,--help}'[Prints a short help text and exits.]' \
|
||||
'(-)--version[Prints a short version string and exits.]' \
|
||||
'--list[Lists all currently pending system password requests.]' \
|
||||
'(-)--version[Prints a short version string and exits.]' \
|
||||
'--list[Lists all currently pending system password requests.]' \
|
||||
'--query[Process all currently pending system password requests by querying the user on the calling TTY.]' \
|
||||
'--watch[Continuously process password requests.]' \
|
||||
'--wall[Forward password requests to wall(1).]' \
|
||||
|
@ -7,14 +7,14 @@
|
||||
}
|
||||
|
||||
(( $+functions[_systemd-analyze_cat-config] )) ||
|
||||
_systemd-analyze_cat-config() {
|
||||
_systemd-analyze_cat-config() {
|
||||
_files -W '(/run/systemd/ /etc/systemd/ /usr/lib/systemd/)' -P 'systemd/'
|
||||
}
|
||||
|
||||
(( $+functions[_systemd-analyze_critical-chain] )) ||
|
||||
_systemd-analyze_critical-chain() {
|
||||
local -a _units
|
||||
systemctl list-units --no-legend --no-pager --plain --all |
|
||||
systemctl list-units --no-legend --no-pager --plain --all 2>/dev/null |
|
||||
while read -r a b c; do
|
||||
_units+=($a)
|
||||
done
|
||||
@ -29,14 +29,14 @@
|
||||
(( $+functions[_systemd-analyze_syscall-filter] )) ||
|
||||
_systemd-analyze_syscall-filter() {
|
||||
local -a _groups
|
||||
_groups=( $(systemd-analyze --quiet --no-pager syscall-filter | grep '^@') )
|
||||
_groups=( $(systemd-analyze --quiet --no-pager syscall-filter 2>/dev/null | grep '^@') )
|
||||
_describe -t groups 'syscall groups' _groups || compadd "$@"
|
||||
}
|
||||
|
||||
(( $+functions[_systemd-analyze_filesystems] )) ||
|
||||
_systemd-analyze_filesystems() {
|
||||
local -a _groups
|
||||
_groups=( $(systemd-analyze --quiet --no-pager filesystems | grep '^@') )
|
||||
_groups=( $(systemd-analyze --quiet --no-pager filesystems 2>/dev/null | grep '^@') )
|
||||
_describe -t groups 'file system groups' _groups || compadd "$@"
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
(( $+functions[_systemd-analyze_transient-settings] )) ||
|
||||
_systemd-analyze_transient-settings() {
|
||||
local -a _types
|
||||
_types=( $(systemctl --no-pager --no-legend -t help) )
|
||||
_types=( $(systemctl --no-pager --no-legend -t help 2>/dev/null) )
|
||||
_describe -t types 'unit types' _types
|
||||
}
|
||||
|
||||
@ -62,8 +62,7 @@
|
||||
'time:Print time spent in the kernel before reaching userspace'
|
||||
'blame:Print list of running units ordered by time to init'
|
||||
'critical-chain:Print a tree of the time critical chain of units'
|
||||
'plot:Output SVG graphic showing service initialization, or raw time data in
|
||||
JSON or table format'
|
||||
'plot:Output SVG graphic showing service initialization, or raw time data in JSON or table format'
|
||||
'dot:Dump dependency graph (in dot(1) format)'
|
||||
'dump:Dump server status'
|
||||
'cat-config:Cat systemd config files'
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
typeset -A sdpath=( ${$(systemd-path)/:/} )
|
||||
_arguments -S \
|
||||
'(- *)'{-h,--help}'[Print help text and exit]' \
|
||||
'(- *)'{-v,--version}'[Print a version string and exit]' \
|
||||
'--suffix=[Append a suffix to the paths]:SUFFIX' \
|
||||
'*:pathname:compadd -k sdpath'
|
||||
'(- *)'{-h,--help}'[Print help text and exit]' \
|
||||
'(- *)'{-v,--version}'[Print a version string and exit]' \
|
||||
'--suffix=[Append a suffix to the paths]:SUFFIX' \
|
||||
'*:pathname:compadd -k sdpath'
|
||||
|
@ -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] )) ||
|
||||
|
@ -50,10 +50,10 @@ _udevadm_trigger(){
|
||||
(( $+functions[_udevadm_settle] )) ||
|
||||
_udevadm_settle(){
|
||||
_arguments \
|
||||
'(-)'{-h,--help}'[Print help]' \
|
||||
'(-)'{-V,--version}'[Print version of the program]' \
|
||||
'(-t --timeout)'{-t,--timeout=}'[Maximum number of seconds to wait for the event queue to become empty.]:SEC' \
|
||||
'(-E --exit-if-exists)'{-E,--exit-if-exists=}'[Stop waiting if file exists.]:files:_files'
|
||||
'(-)'{-h,--help}'[Print help]' \
|
||||
'(-)'{-V,--version}'[Print version of the program]' \
|
||||
'(-t --timeout)'{-t,--timeout=}'[Maximum number of seconds to wait for the event queue to become empty.]:SEC' \
|
||||
'(-E --exit-if-exists)'{-E,--exit-if-exists=}'[Stop waiting if file exists.]:files:_files'
|
||||
}
|
||||
|
||||
(( $+functions[_udevadm_control] )) ||
|
||||
@ -92,7 +92,7 @@ _udevadm_test(){
|
||||
'(-)'{-V,--version}'[Show package version]' \
|
||||
'--action=[The action string.]:actions:(add change remove move online offline bind unbind)' \
|
||||
'(-N --resolve-names)'{-N,--resolve-names=}'[When to resolve names.]:resolve:(early late never)' \
|
||||
'--subsystem=[The subsystem string.]' \
|
||||
'--subsystem=[The subsystem string.]' \
|
||||
'(-D --extra-rules-dir=)'{-D,--extra-rules-dir=}'[Also load rules from the directory.]' \
|
||||
'(-v --verbose)'{-v,--verbose}'[Show verbose logs.]' \
|
||||
'--json=[Generate JSON output]:MODE:(pretty short off)' \
|
||||
@ -102,11 +102,11 @@ _udevadm_test(){
|
||||
(( $+functions[_udevadm_test-builtin] )) ||
|
||||
_udevadm_test-builtin(){
|
||||
if (( CURRENT == 2 )); then
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[Print help]' \
|
||||
'(- *)'{-V,--version}'[Print version of the program]' \
|
||||
'--action=[The action string.]:actions:(add change remove move online offline bind unbind)' \
|
||||
'*::builtins:(blkid btrfs dissect_image factory_reset hwdb input_id keyboard kmod net_driver net_id net_setup_link path_id uaccess usb_id)'
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[Print help]' \
|
||||
'(- *)'{-V,--version}'[Print version of the program]' \
|
||||
'--action=[The action string.]:actions:(add change remove move online offline bind unbind)' \
|
||||
'*::builtins:(blkid btrfs dissect_image factory_reset hwdb input_id keyboard kmod net_driver net_id net_setup_link path_id uaccess usb_id)'
|
||||
elif (( CURRENT == 3 )); then
|
||||
_arguments \
|
||||
'--action=[The action string.]:actions:(add change remove move online offline bind unbind)' \
|
||||
|
@ -4,67 +4,67 @@
|
||||
local -a reply line
|
||||
|
||||
_varlinkctl_interfaces() {
|
||||
compadd "$@" -- \
|
||||
"${(@f)$(_call_program varlink-interfaces varlinkctl list-interfaces $line[2])}"
|
||||
compadd "$@" -- \
|
||||
"${(@f)$(_call_program varlink-interfaces varlinkctl list-interfaces $line[2])}"
|
||||
}
|
||||
|
||||
_varlinkctl_methods() {
|
||||
compadd "$@" -- \
|
||||
"${(@f)$(_call_program varlink-methods varlinkctl list-methods $line[2])}"
|
||||
compadd "$@" -- \
|
||||
"${(@f)$(_call_program varlink-methods varlinkctl list-methods $line[2])}"
|
||||
}
|
||||
|
||||
local -a varlink_addr=(
|
||||
/$'[^\0]#\0'/ ':varlink-addresses:varlink address:_files -g "*(=)"'
|
||||
/$'[^\0]#\0'/ ':varlink-addresses:varlink address:_files -g "*(=)"'
|
||||
)
|
||||
local -a varlink_interface=(
|
||||
$varlink_addr
|
||||
/$'[^\0]#\0'/ ':varlink-interfaces:varlink interface:_varlinkctl_interfaces'
|
||||
$varlink_addr
|
||||
/$'[^\0]#\0'/ ':varlink-interfaces:varlink interface:_varlinkctl_interfaces'
|
||||
)
|
||||
local -a varlink_method=(
|
||||
$varlink_addr
|
||||
/$'[^\0]#\0'/ ':varlink-methods:varlink method:_varlinkctl_methods'
|
||||
$varlink_addr
|
||||
/$'[^\0]#\0'/ ':varlink-methods:varlink method:_varlinkctl_methods'
|
||||
)
|
||||
local -a varlink_call=($varlink_method /$'[^\0]#\0'/ ':argument:argument:()')
|
||||
local -a varlink_idl=(/$'[^\0]#\0'/ ':varlink-idl-file:idl file:_files')
|
||||
|
||||
_regex_words varlink-commands 'varlink command' \
|
||||
'info:show service information:$varlink_addr' \
|
||||
'list-interfaces:List interfaces implemented by a service:$varlink_addr' \
|
||||
'list-methods:List methods implemented by an interface:$varlink_interface' \
|
||||
'introspect:show an interface definition:$varlink_interface' \
|
||||
'call:invoke a method:$varlink_call' \
|
||||
'validate-idl:validate an interface description:$varlink_idl' \
|
||||
'help:show a help message'
|
||||
'info:show service information:$varlink_addr' \
|
||||
'list-interfaces:List interfaces implemented by a service:$varlink_addr' \
|
||||
'list-methods:List methods implemented by an interface:$varlink_interface' \
|
||||
'introspect:show an interface definition:$varlink_interface' \
|
||||
'call:invoke a method:$varlink_call' \
|
||||
'validate-idl:validate an interface description:$varlink_idl' \
|
||||
'help:show a help message'
|
||||
|
||||
local -a varlinkcmd=( /$'[^\0]#\0'/ "$reply[@]" )
|
||||
_regex_arguments _varlinkctl_cmd "$varlinkcmd[@]"
|
||||
|
||||
_varlinkctl_command() {
|
||||
local varlink_command=varlinkctl
|
||||
((CURRENT > 2 )) && varlink_command=varlinkctl-$line[1]
|
||||
local varlink_command=varlinkctl
|
||||
((CURRENT > 2 )) && varlink_command=varlinkctl-$line[1]
|
||||
|
||||
local -a varlink_args
|
||||
case "$line[1]" in
|
||||
(info|list-interfaces)
|
||||
varlink_args=(address) ;;
|
||||
(introspect|list-methods)
|
||||
varlink_args=(address interface) ;;
|
||||
(call)
|
||||
varlink_args=(address method arguments) ;;
|
||||
(validate-idl)
|
||||
varlink_args=(file) ;;
|
||||
esac
|
||||
local -a varlink_args
|
||||
case "$line[1]" in
|
||||
(info|list-interfaces)
|
||||
varlink_args=(address) ;;
|
||||
(introspect|list-methods)
|
||||
varlink_args=(address interface) ;;
|
||||
(call)
|
||||
varlink_args=(address method arguments) ;;
|
||||
(validate-idl)
|
||||
varlink_args=(file) ;;
|
||||
esac
|
||||
|
||||
curcontext="${curcontext%:*:*}:$varlink_command:$varlink_args[CURRENT-2]"
|
||||
_varlinkctl_cmd "$@"
|
||||
curcontext="${curcontext%:*:*}:$varlink_command:$varlink_args[CURRENT-2]"
|
||||
_varlinkctl_cmd "$@"
|
||||
}
|
||||
|
||||
local -a opts=(
|
||||
{-h,--help}'[Show a help message and exit]'
|
||||
'--version[Show package version and exit]'
|
||||
'--no-pager[Do not pipe output to a pager]'
|
||||
'--more[Request multiple responses]'
|
||||
'--collect[Collect multiple responses in a JSON array]'
|
||||
{-j+,--json=}'[Output as json]:json-mode:(pretty short)'
|
||||
{-h,--help}'[Show a help message and exit]'
|
||||
'--version[Show package version and exit]'
|
||||
'--no-pager[Do not pipe output to a pager]'
|
||||
'--more[Request multiple responses]'
|
||||
'--collect[Collect multiple responses in a JSON array]'
|
||||
{-j+,--json=}'[Output as json]:json-mode:(pretty short)'
|
||||
)
|
||||
_arguments -S $opts '*:: := _varlinkctl_command'
|
||||
|
Loading…
x
Reference in New Issue
Block a user