From eea5f4c3ada1322d8947bab36cb25dda9b24982c Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 20 Mar 2018 09:48:17 -0400 Subject: [PATCH] make the script give more useful feedback --- ci/check_line_lengths.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ci/check_line_lengths.sh b/ci/check_line_lengths.sh index b32906da..dc48091c 100755 --- a/ci/check_line_lengths.sh +++ b/ci/check_line_lengths.sh @@ -1,5 +1,21 @@ #!/bin/bash +if [ "$1" == "--help" ]; then + echo 'Usage:' + echo ' MAX_LINE_LENGTH=80' "$0" 'src/**/*.md' + exit 1 +fi + +if [ "$MAX_LINE_LENGTH" == "" ]; then + echo '`MAX_LINE_LENGTH` environment variable not set. Try --help.' + exit 1 +fi + +if [ "$1" == "" ]; then + echo 'No files provided.' + exit 1 +fi + echo "Checking line lengths in all source files <= $MAX_LINE_LENGTH chars..." echo "Offending files and lines:"