Skip to content

Commit

Permalink
feat: support -o|--organize option to control changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore committed Sep 27, 2019
1 parent e4b596d commit 5ed9b2a
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions please
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,21 @@ $(ok Scope:)
$(info minor) $(comment "Bumps the <minor> part of semver.")
$(ok Options:)
$(info "-c --chlog") $(comment "Forces creation of CHANGELOG.md file.")
$(info "-h --help") $(comment "Show help information and usage.")
$(info "-H --chash") $(comment "Prepends commit hash into log.")
$(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 "-V --version") $(comment "Forces the exact version to be released.")
$(info "-y --yes") $(comment "Assume yes for any confirmation.")
$(info "-c --chlog") $(comment "Forces creation of CHANGELOG.md file.")
$(info "-h --help") $(comment "Show help information and usage.")
$(info "-H --chash") $(comment "Prepends commit hash into log.")
$(info "-o --organize") $(comment "Commit types as CSV for changelog or release notes.")
$(comment "(Default: feat,fix,refactor,perf,docs,infra,chore)")
$(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 "-V --version") $(comment "Forces the exact version to be released.")
$(info "-y --yes") $(comment "Assume yes for any confirmation.")
$(ok Examples:)
please
please --update
please --organize feat,fix,docs # only features, fixes and docs are included
please --vfile --chash
please minor --public --yes
please major --vfile --chlog
Expand All @@ -76,7 +79,7 @@ USAGE
}

# organize commits
organize-commits() # $1 = diff_range, $2 = commit_type
organize-commits() # $1 = diff_range, $2 = commit_types_csv
{
declare -A LABELS=(
[feat]=Features
Expand Down Expand Up @@ -214,6 +217,7 @@ do
-H | --chash) GCFMT="${GCFMT} [_%h_](https://github.com/${REPO}/commit/%h)"; shift 1 ;;
-y | --yes) YES=1; shift 1 ;;
-V | --version) NEXT_VERSION=$2; shift 2 ;;
-o | --organize) TYPES=$2; shift 2 ;;
minor) MINOR=1; shift 1 ;;
major) MAJOR=1; shift 1 ;;
*) error "Invalid arg ${1}. (Run ${PLIZ} --help)"; exit 1 ;;
Expand Down Expand Up @@ -265,7 +269,7 @@ fi
ok " Done [${VERSION}]"
info "Collecting commits ..."
COMMITS=`organize-commits "$RANGE"`
COMMITS=`organize-commits "$RANGE" "$TYPES"`
ok
if [ "" == "$COMMITS" ]; then
Expand Down

0 comments on commit 5ed9b2a

Please sign in to comment.