Browse Source

new: [compose-core] add ``-c|--color`` argument to force color mode

cache-relation
Valentin Lab 1 year ago
parent
commit
9f4faac412
  1. 19
      bin/compose-core

19
bin/compose-core

@ -3857,6 +3857,7 @@ display_help() {
echo " Will rebuild all relations to given service" echo " Will rebuild all relations to given service"
echo " --add-compose-content, -Y YAML" echo " --add-compose-content, -Y YAML"
echo " Will merge some direct YAML with the current compose" echo " Will merge some direct YAML with the current compose"
echo " -c, --color Force color mode (default is to detect if in tty mode)"
get_docker_compose_opts_help | remove_options_in_option_help_msg --version --help --verbose | get_docker_compose_opts_help | remove_options_in_option_help_msg --version --help --verbose |
filter_docker_compose_help_message filter_docker_compose_help_message
@ -4094,6 +4095,7 @@ 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=
rebuild_relations_to_service=() rebuild_relations_to_service=()
color=
declare -A without_relations declare -A without_relations
DC_MATCH_MULTI=$(get_docker_compose_multi_opts_list) && DC_MATCH_MULTI=$(get_docker_compose_multi_opts_list) &&
DC_MATCH_SINGLE=$(get_docker_compose_single_opts_list) || exit 1 DC_MATCH_SINGLE=$(get_docker_compose_single_opts_list) || exit 1
@ -4134,6 +4136,23 @@ while read-0 arg; do
compose_opts+=("--project-name $value") compose_opts+=("--project-name $value")
shift shift
;; ;;
--color|-c)
if [ "$color" == "0" ]; then
err "Conflicting option --color with previous --no-ansi."
exit 1
fi
color=1
ansi_color yes
;;
--no-ansi)
if [ "$color" == "1" ]; then
err "Conflicting option --no-ansi with previous --color."
exit 1
fi
color=0
ansi_color no
compose_opts+=("--no-ansi")
;;
--no-relations) --no-relations)
export no_relations=true export no_relations=true
;; ;;

Loading…
Cancel
Save