fix(omz): fix cmr target-branch argument parsing
This commit is contained in:
@@ -177,39 +177,50 @@ function gcmr() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cmr() {
|
function cmr() {
|
||||||
if [[ "$*" == "--draft" ]]
|
local draft=""
|
||||||
then
|
local target_branch=""
|
||||||
draft="--draft"
|
local reviewer=""
|
||||||
else
|
|
||||||
draft=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
reviewers=""
|
while [[ $# -gt 0 ]]; do
|
||||||
if [[ $1 =~ .*",".* ]]; then
|
case "$1" in
|
||||||
reviewers="--reviewer=$1";
|
--draft)
|
||||||
fi;
|
draft="--draft"
|
||||||
|
;;
|
||||||
|
--target-branch=*)
|
||||||
|
target_branch="${1#--target-branch=}"
|
||||||
|
;;
|
||||||
|
--target-branch)
|
||||||
|
target_branch="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
reviewer="$1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
current_branch=$(git branch --show-current)
|
current_branch=$(git branch --show-current)
|
||||||
if [[ $current_branch == "master" ]] || [[ $current_branch == "beta" ]] || [[ $current_branch == "acceptance" ]] || [[ $current_branch == "main" ]] || [[ $current_branch == "release" ]] ;
|
if [[ $current_branch == "master" ]] || [[ $current_branch == "beta" ]] || [[ $current_branch == "acceptance" ]] || [[ $current_branch == "main" ]] || [[ $current_branch == "release" ]]; then
|
||||||
then echo "Checkout a feature branch" && return;
|
echo "Checkout a feature branch" && return
|
||||||
fi;
|
|
||||||
|
|
||||||
# Check if 'main' branch exists in the remote repository
|
|
||||||
current_project=$(basename $(pwd))
|
|
||||||
|
|
||||||
if [[ ! -z $2 ]]; then
|
|
||||||
target_branch=$2
|
|
||||||
elif [[ $current_project =~ "vrm-(front|api)" ]]; then
|
|
||||||
target_branch="release"
|
|
||||||
else
|
|
||||||
target_branch="master"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $1 == "--target-branch" ]]; then
|
if [[ -z "$target_branch" ]]; then
|
||||||
target_branch=$2
|
current_project=$(basename $(pwd))
|
||||||
fi;
|
local pattern="vrm-(front|api)"
|
||||||
|
if [[ $current_project =~ $pattern ]]; then
|
||||||
|
target_branch="release"
|
||||||
|
else
|
||||||
|
target_branch="master"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
glab mr create -a oliver $reviewers --target-branch=$target_branch -t "Merge branch: '$(git branch --show-current)' into $target_branch" --fill -y $draft
|
local reviewers_arg=""
|
||||||
|
if [[ -n "$reviewer" ]]; then
|
||||||
|
reviewers_arg="--reviewer=$reviewer"
|
||||||
|
fi
|
||||||
|
|
||||||
|
glab mr create -a oliver $reviewers_arg --target-branch=$target_branch -t "Merge branch: '$(git branch --show-current)' into $target_branch" --fill -y $draft
|
||||||
}
|
}
|
||||||
|
|
||||||
function glisu() {
|
function glisu() {
|
||||||
|
|||||||
Reference in New Issue
Block a user