| { 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.
list-timers list-units list-unit-files poweroff
reboot rescue show-environment suspend get-default
is-system-running preset-all list-automounts list-paths'
- [FILE]='link switch-root bind mount-image'
+ [FILE]='link switch-root'
[TARGETS]='set-default'
[MACHINES]='list-machines'
[LOG_LEVEL]='log-level'
[SERVICE_LOG_LEVEL]='service-log-level'
[SERVICE_LOG_TARGET]='service-log-target'
[SERVICE_WATCHDOGS]='service-watchdogs'
+ [MOUNT]='bind mount-image'
)
for ((i=0; i < COMP_CWORD; i++)); do
fi
elif __contains_word "$verb" ${VERBS[SERVICE_WATCHDOGS]}; then
comps='on off'
+ elif __contains_word "$verb" ${VERBS[MOUNT]}; then
+ if __contains_word "$prev" ${VERBS[MOUNT]}; then
+ comps=$( __get_active_services $mode "$cur" )
+ elif [[ "$prev" =~ .service ]]; then
+ comps=$( compgen -A file -- "$cur" )
+ compopt -o filenames
+ else
+ return 0
+ fi
fi
COMPREPLY=( $(compgen -o filenames -W '$comps' -- "$cur_orig") )