Skip to content

Commit ae28933

Browse files
author
Bhavi Dhingra
committed
refactor(ask): yes first by default
1 parent 9c031db commit ae28933

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

.gitcommitscopes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
ask
12
gadd
23
gbranchcreate
34
gcommit

cmd/gbranchcreate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function main() {
4343

4444
printf "\r"
4545

46-
local confirmation="$(__ask "Create branch ${BLUE}${branchName}${RESET} ?" "false")"
46+
local confirmation="$(__ask "Create branch ${BLUE}${branchName}${RESET} ?")"
4747
[ "${confirmation}" != "yes" ] && return
4848

4949
git branch "${branchName}"

cmd/gcommit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function main() {
3333
fi
3434
gstatus
3535

36-
local commitAll="$(__ask "Stage all the files?" "false")"
36+
local commitAll="$(__ask "Stage all the files?")"
3737
if [[ "${commitAll}" == "yes" ]]; then
3838
git add -A
3939
else

util/__ask

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ source "${__CUSTOM_GIT_UTIL}"/fzf_headers/__ask_header
88
function __ask() {
99

1010
local question="${1}"
11-
local noFirst="${2:-"true"}"
12-
local escAction="${3:-"exits"}"
13-
local options=("no" "yes")
14-
[ "${noFirst}" == "false" ] && options=("yes" "no")
11+
local yesFirst="${2:-"true"}"
12+
local escAction="${3:-"exit"}"
13+
local options=("yes" "no")
14+
[ "${yesFirst}" == "false" ] && options=("no" "yes")
1515

1616
local ASK_HEADER="$(__ask_header "${question}" "${escAction}")"
1717
local choice="$(printf "%s\n" "${options[@]}" |\

0 commit comments

Comments
 (0)