From 6418227cdfb4b6b32e8489bd030d840a72706172 Mon Sep 17 00:00:00 2001 From: Arlandis Lawrence Date: Mon, 1 Sep 2014 19:36:06 -0500 Subject: [PATCH] Treat '--speclj' as an alternative help option --- spec/clj/speclj/cli_spec.clj | 9 +++++++++ src/clj/speclj/cli.clj | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/spec/clj/speclj/cli_spec.clj b/spec/clj/speclj/cli_spec.clj index 0488dd1..7c0bcca 100644 --- a/spec/clj/speclj/cli_spec.clj +++ b/spec/clj/speclj/cli_spec.clj @@ -59,6 +59,15 @@ (should= 0 (run "--help")) (should-not= -1 (.indexOf (to-s @output) "Usage"))) + (it "parses the --speclj switch" + (should= nil (:speclj (parse-args ""))) + (should= "on" (:speclj (parse-args "--speclj"))) + (should= "on" (:speclj (parse-args "-S")))) + + (it "handles the --speclj switch" + (should= 0 (run "--speclj")) + (should-not= -1 (.indexOf (to-s @output) "Usage"))) + (it "parses and translates the --autotest option" (let [options (parse-args "--autotest")] (should= "vigilant" (:runner options)) diff --git a/src/clj/speclj/cli.clj b/src/clj/speclj/cli.clj index 867577f..f9dd4d5 100644 --- a/src/clj/speclj/cli.clj +++ b/src/clj/speclj/cli.clj @@ -30,7 +30,7 @@ (.addMultiOption "t" "tag" "TAG" "Run only the characteristics with the specified tag(s).\nTo exclude characteristics, prefix the tag with ~ (eg ~slow). Use this option multiple times to filter multiple tags.") (.addSwitchOption "v" "version" "Shows the current speclj version.") (.addSwitchOption "h" "help" "You're looking at it.") - ) + (.addSwitchOption "S" "speclj" "You're looking at it.")) (defn- resolve-runner-alias [name] (cond @@ -97,6 +97,6 @@ (cond (:*errors config) (usage (:*errors config)) (:version config) (do (print-version) 0) - (:help config) (usage nil) + (or (:speclj config) (:help config)) (usage nil) :else (or (do-specs config) 0))))