Skip to content

Commit 8a96882

Browse files
author
Bhavi Dhingra
committed
feat(gbranchout): optional branch type
1 parent 4781473 commit 8a96882

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

cmd/gbranchout

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ function main() {
2828
print_branch_name "${branchName}"
2929

3030
local branchType="$(get_branch_type)"
31-
[ -z "${branchType}" ] && {
32-
__print_info "branch type can't be empty"
33-
return
34-
}
35-
branchName="${branchName}${branchType}/"
31+
[ -n "${branchType}" ] && branchName="${branchName}${branchType}/"
3632
print_branch_name "${branchName}"
3733

3834
local name="$(get_branch_name)"

util/fzf_headers/gbranch/__name_header

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function __name_header() {
1212
local edge="$(echo "${msg}" | sed "s/./-/g")"
1313
local GBRANCH_NAME_HEADER="${edge}\n"
1414

15-
local colorMsg="${UNDERLINE}${MAGENTA}gbranch${RESET} follows the format ${BLUE}[optional prefix]/<type>/<branch_name>${RESET} \n"
15+
local colorMsg="${UNDERLINE}${MAGENTA}gbranch${RESET} follows the format ${BLUE}[optional prefix]/[optional type]/<branch_name>${RESET} \n"
1616
colorMsg="${colorMsg}${BLUE}<enter>: ${RESET}Creates the new branch, "
1717
colorMsg="${colorMsg}${BLUE}<esc>: ${RESET}exit\n\n"
1818
colorMsg="${colorMsg}What is the branch name?"

util/fzf_headers/gbranch/__prefix_header

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function __prefix_header() {
1212
local edge="$(echo "${msg}" | sed "s/./-/g")"
1313
local GBRANCH_PREFIX_HEADER="${edge}\n"
1414

15-
local colorMsg="${UNDERLINE}${MAGENTA}gbranch${RESET} follows the format ${BLUE}[optional prefix]/<type>/<branch_name>${RESET} \n"
15+
local colorMsg="${UNDERLINE}${MAGENTA}gbranch${RESET} follows the format ${BLUE}[optional prefix]/[optional type]/<branch_name>${RESET} \n"
1616
colorMsg="${colorMsg}${BLUE}<enter>: ${RESET}Add the prefix to the branch name, "
1717
colorMsg="${colorMsg}${BLUE}<esc>: ${RESET}skip\n\n"
1818
colorMsg="${colorMsg}(optional) Give a prefix to the branch name (e.g. issue number / JIRA ticket etc.)"

util/fzf_headers/gbranch/__type_header

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ function __type_header() {
1010

1111
local msg="<enter>: select branch type, <?>: toggle type definition, <esc>: quit"
1212

13-
local colormsg="${UNDERLINE}${MAGENTA}gbranch${RESET} follows the format ${BLUE}[optional prefix]/<type>/<branch_name>${RESET} \n\
13+
local colormsg="${UNDERLINE}${MAGENTA}gbranch${RESET} follows the format ${BLUE}[optional prefix]/[optional type]/<branch_name>${RESET} \n\
1414
${BLUE}<enter>: ${RESET}select branch type, \
1515
${BLUE}<?>: ${RESET}toggle type definition, \
16-
${BLUE}<esc>: ${RESET}exit\n\n"
16+
${BLUE}<esc>: ${RESET}skip\n\n"
1717

1818
colormsg="${colormsg}Select the type of branch"
1919

0 commit comments

Comments
 (0)