Browse Source

new: dev: [compose-core] introduce ``is_docker_compose_action_multi_service`` variable for convenience

master
Valentin Lab 1 month ago
parent
commit
c01460dffd
  1. 11
      bin/compose-core

11
bin/compose-core

@ -4667,6 +4667,7 @@ no_init=
action= action=
stage="main" ## switches from 'main', to 'action', 'remainder' stage="main" ## switches from 'main', to 'action', 'remainder'
is_docker_compose_action= is_docker_compose_action=
is_docker_compose_action_multi_service=
rebuild_relations_to_service=() rebuild_relations_to_service=()
color= color=
declare -A without_relations declare -A without_relations
@ -4806,6 +4807,12 @@ while read-0 arg; do
fi fi
pos_args=($(echo "$DC_USAGE" | sed -r 's/\[-[^]]+\] ?//g;s/\[options\] ?//g')) pos_args=($(echo "$DC_USAGE" | sed -r 's/\[-[^]]+\] ?//g;s/\[options\] ?//g'))
pos_args=("${pos_args[@]:1}") pos_args=("${pos_args[@]:1}")
if [[ "${pos_args[0]}" == "[SERVICE...]" ]]; then
is_docker_compose_action_multi_service=1
elif [[ "${pos_args[0]}" == "SERVICE" ]]; then
is_docker_compose_action_multi_service=0
fi
# echo "USAGE: $DC_USAGE" # echo "USAGE: $DC_USAGE"
# echo "pos_args: ${pos_args[@]}" # echo "pos_args: ${pos_args[@]}"
# echo "MULTI: $DC_MATCH_MULTI" # echo "MULTI: $DC_MATCH_MULTI"
@ -5006,8 +5013,10 @@ if [ -n "$is_docker_compose_action" ] && [ "${#services_args[@]}" -gt 0 ]; then
seen[$mservice]=1 seen[$mservice]=1
action_posargs+=("$mservice") action_posargs+=("$mservice")
done done
else
elif [ "$is_docker_compose_action_multi_service" == "1" ]; then
action_posargs+=("${services[@]}") action_posargs+=("${services[@]}")
elif [ "$is_docker_compose_action_multi_service" == "0" ]; then
action_posargs+=("${services[0]}") ## only the first service is the legit one
fi fi
## Get rid of subordinates ## Get rid of subordinates
action_posargs=($(get_master_services "${action_posargs[@]}")) || exit 1 action_posargs=($(get_master_services "${action_posargs[@]}")) || exit 1

Loading…
Cancel
Save