Skip to content

Commit

Permalink
feat(please): add confirmation prompt with --yes option
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore committed Aug 25, 2018
1 parent 305d5b8 commit e3e99c9
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion please
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ $(ok Options:)
$(info "-p --public") $(comment "Set scoped npm package for public access.")
$(info "-u --update") $(comment "Update ${PLIZ} to latest version.")
$(info "-v --vfile") $(comment "Forces creation of VERSION file.")
$(info "-y --yes") $(comment "Assume yes for any confirmation.")
$(ok Examples:)
please
please --update
please --vfile --chash
please minor --public
please minor --public --yes
please major --vfile --chlog
USAGE
exit 0
Expand Down Expand Up @@ -175,6 +176,10 @@ do
GCFMT="[%h](https://github.com/${REPO}/commit/%h) ${GCFMT}"
shift 1
;;
-y | --yes)
YES=1
shift 1
;;
minor)
MINOR=1
shift 1
Expand All @@ -195,6 +200,7 @@ MAJOR=${MAJOR:-0} # bump major
MINOR=${MINOR:-0} # bump minor
VFILE=${VFILE:-0} # create version file
CHLOG=${CHLOG:-0} # create changelog file
YES=${YES:-0} # assume yes

# gh auth
if [ -z "${GH_AUTH_TOKEN}" ]; then
Expand Down Expand Up @@ -243,6 +249,14 @@ else
NEXT_VERSION=`echo $VERSION | (IFS=".$IFS"; read a b c && echo $a.$b.$((c + 1)))`
fi

if [[ $YES -eq 0 ]]; then
read -p "Are you sure to release [${NEXT_VERSION}]? [y/N] " -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
error "\nNot releasing ${NEXT_VERSION}"
exit 1
fi
fi

# changelog backup
OLD=""
if [ -f ./CHANGELOG.md ]; then
Expand Down

0 comments on commit e3e99c9

Please sign in to comment.