Skip to content

Commit

Permalink
Per project branches
Browse files Browse the repository at this point in the history
  • Loading branch information
abnegate committed Jul 26, 2022
1 parent 0658981 commit ab168a7
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions dit
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ branch() {
# Build the project
#
build() {
docker compose --project-name "$(branch)" build "$@"
docker compose --project-name "$(__get_project)" build "$@"
}

#
Expand All @@ -58,7 +58,7 @@ diff() {
# Bring down project
#
down() {
docker compose --project-name "$(branch)" down $*
docker compose --project-name "$(__get_project)" down "$@"
}

#
Expand Down Expand Up @@ -97,7 +97,7 @@ push() {
# Restart project
#
restart() {
docker compose --project-name "$(branch)" restart "$@"
docker compose --project-name "$(__get_project)" restart "$@"
}

#
Expand Down Expand Up @@ -187,10 +187,8 @@ reup() {
shift
done

docker compose --project-name "$(branch)" down ${volumes}

# shellcheck disable=SC2086
docker compose --project-name "$(branch)" up ${up}
docker compose --project-name "$(__get_project)" down ${volumes}
docker compose --project-name "$(__get_project)" up ${up}
}

#
Expand Down Expand Up @@ -222,12 +220,10 @@ run() {
exit 1
fi

# shellcheck disable=SC2086
docker run --rm --interactive --tty "${image}" ${args}
fi

# shellcheck disable=SC2086
docker compose --project-name "$(branch)" exec --interactive --tty ${args}
docker compose --project-name "$(__get_project)" exec --interactive --tty ${args}
}

#
Expand Down Expand Up @@ -411,7 +407,7 @@ up() {
done

# shellcheck disable=SC2086
docker compose --project-name "$(branch)" up ${up}
docker compose --project-name "$(__get_project)" up ${up}

__save_branch
}
Expand Down Expand Up @@ -476,6 +472,10 @@ Usage: dit <command> [options]
"
}

__get_project() {
printf "%s" "$(basename "$(git rev-parse --show-toplevel)")-$(branch)"
}

#
# Save the current branch name to a list in a file
#
Expand Down

0 comments on commit ab168a7

Please sign in to comment.