From: Dan Vanderkam Date: Fri, 10 Aug 2012 15:38:17 +0000 (-0400) Subject: allow lint.sh to take a file as a command-line argument X-Git-Tag: v1.0.0~200 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=fefe0bfe5e8e551e1fdb886408a335139a5f8ba3;p=dygraphs.git allow lint.sh to take a file as a command-line argument --- diff --git a/lint.sh b/lint.sh index 890820d..6c640ad 100755 --- a/lint.sh +++ b/lint.sh @@ -1,8 +1,23 @@ #!/bin/bash +# +# Usage: +# ./lint.sh [file.js] +# +# The zero-argument form lints everything. + jsc_opts='maxerr:10000,devel:true,browser:true' rhino_opts='maxerr=10000,devel=true,browser=true' -files=$(ls dygraph*.js | grep -v combined | grep -v dev.js); +if [ $# -gt 1 ]; then + echo "Usage: $0 [file.js]" + exit 1 +fi + +if [ $# -eq 0 ]; then + files=$(ls dygraph*.js plugins/*.js | grep -v combined | grep -v dev.js) +else + files=$1 +fi if [ -e /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc ]; then # use JSC (Safari/JavaScriptCore) to run JSHint -- much faster than Rhino.