This simple program takes one argument (title of JIRA task name) and creates a ready to use git command to create a feature branch in a git repository.
This is program with command line interface, so it needs to start fast. It is configured to build a native image using scala-native. Scala-native requires runtime dependencies which are described at https://scala-native.readthedocs.io/en/latest/user/setup.html. Please follow instructions provided there to install them.
$ sbt run
$ sbt nativeLink
The native image (executable) can be found in:
target/scala-2.13/git-branch-for-jira-task-out
Tested on Ubuntu linux.
A typical case:
$ git-branch-for-jira-task-out "ABC-1 Make a new awesome feature"
git checkout -b 'feature/ABC-1-make-a-new-awesome-feature'
Remove tag after issue identifier:
$ git-branch-for-jira-task-out "ABC-1 [Backend] Make a new awesome feature on back-end"
git checkout -b 'feature/ABC-1-make-a-new-awesome-feature-on-back-end'
Remove unnecessary spaces:
$ git-branch-for-jira-task-out " ABC-1 Make a new awesome feature "
git checkout -b 'feature/ABC-1-make-a-new-awesome-feature'
Use custom issue delimiter and create bugfix branch:
$ git-branch-for-jira-task-out -b -d "-<+>-" "ABC-1 Make a new awesome feature for star wars fans "
git checkout -b 'bugfix/ABC-1-<+>-make-a-new-awesome-feature-for-star-wars-fans'
Note: You can execute prepared command by pipelining it to bash:
$ git-branch-for-jira-task-out "ABC-1 Make a new awesome feature" | bash
Run unit tests as usual:
$ sbt test
scopt is used to parse command line options.
MUnit is used as testing framework.