}
__get_units_all() {
- systemctl list-units --no-legend --no-pager --plain --all | \
+ systemctl list-units --no-legend --no-pager --plain --all $1 | \
{ while read -r a b c; do echo " $a"; done }
}
fi
done
+ if __contains_word "--user" ${COMP_WORDS[*]}; then
+ mode=--user
+ else
+ mode=--system
+ fi
+
if __contains_word "$prev" ${OPTS[ARG]}; then
case $prev in
--host|-H)
if [[ $cur = -* ]]; then
comps='--help --version --system --user --fuzz --no-pager'
else
- comps=$( __get_units_all )
+ comps=$( __get_units_all $mode )
fi
elif __contains_word "$verb" ${VERBS[DOT]}; then
if [[ $cur = -* ]]; then
comps='--help --version --system --user --no-pager'
else
- comps=$( __get_units_all )
+ comps=$( __get_units_all $mode )
fi
elif __contains_word "$verb" ${VERBS[SECCOMP_FILTER]}; then
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
if [[ $cur = -* ]]; then
comps='--help --version --no-pager --system --user -H --host -M --machine --offline --threshold --security-policy --json=off --json=pretty --json=short --root --image --profile=default --profile=nonetwork --profile=strict --profile=trusted'
elif ! __contains_word "--offline" ${COMP_WORDS[*]}; then
- if __contains_word "--user" ${COMP_WORDS[*]}; then
- mode=--user
- else
- mode=--system
- fi
comps=$( __get_services $mode )
else
comps="$CONFIGS $( compgen -A file -- "$cur" )"
if [[ $cur = -* ]]; then
comps='--help --version --system --user --global --no-pager --root --image'
elif [[ $prev = "-u" ]] || [[ $prev = "--unit" ]]; then
- if __contains_word "--user" ${COMP_WORDS[*]}; then
- mode=--user
- else
- mode=--system
- fi
comps=$( __get_services $mode )
fi