aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-02-20 23:59:53 +0100
committerTeddy Wing2018-02-21 00:00:20 +0100
commit35ef2b97617e6f5ca5c6b59f8a25317c54288094 (patch)
tree52506a186048888d3b5de79a1fafb7357bc22cbe
parente6c4aab711c4068a736ba80d98359aeebc11e1b3 (diff)
downloadgit-branch-list-35ef2b97617e6f5ca5c6b59f8a25317c54288094.tar.bz2
git-branch-list: Add usage output
Not using `--help` because Git uses this flag to open a `man` page for the subcommand, and I don't have a `man` page.
-rwxr-xr-xgit-branch-list14
1 files changed, 14 insertions, 0 deletions
diff --git a/git-branch-list b/git-branch-list
index 9a24ccf..e7c1665 100755
--- a/git-branch-list
+++ b/git-branch-list
@@ -10,6 +10,15 @@ function initialise_database () {
fi
}
+function print_usage () {
+ cat 1>&2 <<__EOF__
+usage: git branch-list
+ or: git branch-list save
+ or: git branch-list drop
+ or: git branch-list ID
+__EOF__
+}
+
function save_branch () {
local branch=$(branch_or_current_branch "$1")
@@ -82,6 +91,11 @@ command="$1"
initialise_database
case "$command" in
+ -h)
+ print_usage
+
+ exit 0
+ ;;
save)
save_branch "$2"
;;