feat: Add script utils
* feat: Add script utils - Closes #1 * Closes #issue-1 add script utils Signed-off-by: Arthurim <arthurbdauphine@gmail.com> * feat: add script utils Closes #issue-1 Signed-off-by: Arthurim <arthurbdauphine@gmail.com> Signed-off-by: Arthurim <arthurbdauphine@gmail.com>
This commit is contained in:
parent
0e42ab6ba4
commit
b078bc69d0
11
scripts/commit.sh
Normal file
11
scripts/commit.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# bash script to commit in accordance with the branch name
|
||||||
|
# usage: ./scripts/commit.sh
|
||||||
|
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
|
||||||
|
branch="${branch##*feat/}"
|
||||||
|
branch="${branch//\_/ }"
|
||||||
|
issue_number="${branch//Issue\-/}"
|
||||||
|
title=$( cut -d ' ' -f 2- <<< "$issue_number" )
|
||||||
|
issue_number=$( cut -d ' ' -f 1 <<< "$issue_number" )
|
||||||
|
commit_message="feat: $title Closes #$issue_number"
|
||||||
|
git commit -sam "$commit_message"
|
5
scripts/commit_and_push.sh
Normal file
5
scripts/commit_and_push.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# commits and push
|
||||||
|
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
|
||||||
|
./scripts/commit.sh
|
||||||
|
git push --set-upstream origin $branch
|
22
scripts/create_new_branch.sh
Normal file
22
scripts/create_new_branch.sh
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# bash script to create a new branch that respects the library standard
|
||||||
|
#### ./scripts/create_new_branch.sh "[FEAT] - Implement instrument types #14"
|
||||||
|
#### ./scripts/create_new_branch.sh "[FEAT] Implement instrument types #14"
|
||||||
|
#### ./scripts/create_new_branch.sh "[FEAT] - Implement instrument types#14"
|
||||||
|
base_issue=$1
|
||||||
|
issue_number=${base_issue##*#}
|
||||||
|
issue="${base_issue%%#*}"
|
||||||
|
issue="${issue//\[FEAT\] \- /}"
|
||||||
|
issue="${issue/\[FEAT\] /}"
|
||||||
|
issue="${issue/\[FEAT\]/}"
|
||||||
|
issue="${issue// /\_}"
|
||||||
|
branch_name="feat/issue-$issue_number ${issue,,}"
|
||||||
|
branch_name="${branch_name// /\_}"
|
||||||
|
last_char="${branch_name: -1}"
|
||||||
|
if [ "$last_char" = "_" ]
|
||||||
|
then
|
||||||
|
branch_name=${branch_name::-1}
|
||||||
|
fi
|
||||||
|
git checkout -b $branch_name
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user