Skip to content

Commit 8c0646b

Browse files
committed
refactor: update usage info, rename --before-github to --before-vcs
1 parent cfecd24 commit 8c0646b

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

please

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,16 @@ github()
4747
usage()
4848
{
4949
cat << USAGE
50-
${PLIZ} $(info `version`) | $(ok "(c) Jitendra Adhikari")
51-
${PLIZ} is github release made easy. If you embrace semver this is the right tool.
50+
${PLIZ} $(info `version`) | $(ok "(c) Jitendra Adhikari") | ${PLIZ} is semver release made easy.
5251
53-
$(ok Usage:)
54-
${PLIZ} [command]
55-
${PLIZ} [scope] [--options]
52+
$(ok Usage:) ${PLIZ} [command|scope] [--options]
5653
5754
$(ok Commands:)
58-
$(info version) $(comment "Print current version of itself.")
59-
$(info help) $(comment "Show help information and usage.")
60-
55+
$(info version) $(comment "Print current version of itself.")
56+
$(info help) $(comment "Show help information and usage examples.")
6157
$(ok Scope:)
62-
$(info major) $(comment "Bumps the <major> part of semver.")
63-
$(info minor) $(comment "Bumps the <minor> part of semver.")
64-
58+
$(info major) $(comment "Bumps the <major> part of semver.")
59+
$(info minor) $(comment "Bumps the <minor> part of semver.")
6560
$(ok Options:)
6661
$(info "-c --chlog") $(comment "Forces creation of CHANGELOG.md file.")
6762
$(info "-h --help") $(comment "Show help information and usage.")
@@ -73,17 +68,29 @@ $(ok Options:)
7368
$(info "-v --vfile") $(comment "Forces creation of VERSION file.")
7469
$(info "-V --version") $(comment "Forces the exact version to be released.")
7570
$(info "-y --yes") $(comment "Assume yes for any confirmation.")
71+
$(ok Events:)
72+
$(info "--before-all") $(comment "Run the command before anything (very start).")
73+
$(info "--before-npm") $(comment "Run the command before releasing to npm.")
74+
$(info "--before-push") $(comment "Run the command before pushing code to remote.")
75+
$(info "--before-vcs") $(comment "Run the command before releasing to VCS.")
76+
$(info "--after-all") $(comment "Run the command after everything finishes.")
77+
(See https://github.com/adhocore/please#events for more info)
78+
USAGE
7679

80+
if [ "$1" == "help" ]; then
81+
cat << EXAMPLE
7782
$(ok Examples:)
78-
please
79-
please version $(comment "# prints current version of itself")
80-
please --update $(comment "# updates please if new version available")
81-
please --organize feat,fix,docs $(comment "# includes only features, fixes and docs")
82-
please --vfile --chash $(comment "# creates VERSION file, adds commit hash")
83-
please minor --public --yes $(comment "# releases minor version without asking")
84-
please major --vfile --chlog $(comment "# releases next major version with VERSION and CHANGELOG files")
85-
please --vfile --chlog --version 1.5.0 $(comment "# releases version 1.5.0 with VERSION and CHANGELOG files")
86-
USAGE
83+
${PLIZ}
84+
${PLIZ} version $(comment "# prints current version of itself")
85+
${PLIZ} --update $(comment "# updates ${PLIZ} if new version available")
86+
${PLIZ} --organize feat,fix,docs $(comment "# includes only features, fixes and docs")
87+
${PLIZ} --vfile --chash $(comment "# creates VERSION file, adds commit hash")
88+
${PLIZ} minor --public --yes $(comment "# releases minor version without asking")
89+
${PLIZ} major --vfile --chlog $(comment "# releases next major version with VERSION and CHANGELOG files")
90+
${PLIZ} --vfile --chlog --version 1.5.0 $(comment "# releases version 1.5.0 with VERSION and CHANGELOG files")
91+
${PLIZ} --before-all 'echo {REPO}' $(comment "# before release, runs 'echo {REPO}' with REPO interpolated")
92+
EXAMPLE
93+
fi
8794
exit 0
8895
}
8996

@@ -192,7 +199,6 @@ publish-phar()
192199
https://uploads.${GH_REPO}/releases/${LAST_RELEASE_ID}/assets?name=${NAME}" \
193200
| jq -r '.size'`
194201
ok
195-
196202
info "[OK] ${NAME} ${SIZE} bytes"
197203
}
198204
@@ -244,7 +250,7 @@ fi
244250
while [[ $# -gt 0 ]]
245251
do
246252
case "$1" in
247-
-h | --help | help) usage ;;
253+
-h | --help | help) usage $1 ;;
248254
-u | --update) update ;;
249255
-v | --vfile) VFILE=1; shift 1 ;;
250256
-p | --public) PUBLIC="--access=public"; shift 1 ;;
@@ -388,7 +394,7 @@ if [[ $GPUSH -eq 1 ]]; then
388394
fi
389395
390396
# github release
391-
trigger before-github
397+
trigger before-vcs
392398
info "Releasing $NEXT_VERSION ..."
393399
COMMITS=`printf %s "$COMMITS"`
394400
LAST_RELEASE_ID=`curl --silent -H "Authorization: token ${GH_AUTH_TOKEN}" \

0 commit comments

Comments
 (0)