From 6bbcbe9b067175a50c907510c345e8416acbb39d Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 10 Jun 2019 10:59:28 +0200 Subject: code-review: Add usage output Print a real usage message. --- code-review | 19 +++++++++++++++++-- 1 file 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] [] + + 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 -- cgit v1.2.3