diff options
author | Teddy Wing | 2019-06-10 10:59:28 +0200 |
---|---|---|
committer | Teddy Wing | 2019-06-10 10:59:28 +0200 |
commit | 6bbcbe9b067175a50c907510c345e8416acbb39d (patch) | |
tree | 7a13906112a02b268bd1d784f958826141d34162 | |
parent | 9a4f0738e7da4ae5789e5f7146b02d694758a5bb (diff) | |
download | code-review-6bbcbe9b067175a50c907510c345e8416acbb39d.tar.bz2 |
code-review: Add usage output
Print a real usage message.
-rwxr-xr-x | code-review | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/code-review b/code-review index 727251a..bc36d69 100755 --- a/code-review +++ b/code-review @@ -3,6 +3,21 @@ EX_USAGE=64 +function print_usage () { + cat <<-EOF + usage: code-review [--help] <command> [<args>] + + Commands: + + changed-files List names of files changed + commits One-line log of commits + diff Unified diff of changes + difftool Diff of all changes with Vim and Fugitive + start Start a review with a given base revision + stat Stat file changes + EOF +} + function program_exists () { local program="$1" @@ -15,8 +30,8 @@ subcommand="$1" shift -if [ -z "$subcommand" ]; then - echo 'TODO: print usage' +if [ -z "$subcommand" ] || [ "$1" = '--help' ] || [ "$1" = '-h' ]; then + print_usage exit "$EX_USAGE" fi |