From cb3c784c66947029f97136ca42565c37af62dc60 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Sun, 15 Dec 2019 22:30:06 +0100 Subject: [PATCH] fix: support running in directory having name containing uppercase The direct parent could be used to make the default project name, and uppercase are not supported for container names. Signed-off-by: Valentin Lab --- bin/compose-core | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/compose-core b/bin/compose-core index 43f2d09..cd4a013 100755 --- a/bin/compose-core +++ b/bin/compose-core @@ -3045,15 +3045,19 @@ export -f _save get_default_project_name() { - if [ "$DEFAULT_PROJECT_NAME" ]; then + local normalized_path compose_yml_location name + if [ -n "$DEFAULT_PROJECT_NAME" ]; then echo "$DEFAULT_PROJECT_NAME" return 0 fi compose_yml_location="$(get_compose_yml_location)" || return 1 - if [ "$compose_yml_location" ]; then + if [ -n "$compose_yml_location" ]; then if normalized_path=$(readlink -f "$compose_yml_location"); then - name="$(basename "$(dirname "$normalized_path")")" - echo "${name%%-deploy}" + name="${normalized_path%/*}" ## dirname + name="${name##*/}" ## basename + name="${name%%-deploy}" ## remove any '-deploy' + name="${name,,}" ## lowercase + e "$name" return 0 fi fi