Skip to content

Commit

Permalink
Treat '--speclj' as an alternative help option
Browse files Browse the repository at this point in the history
  • Loading branch information
arlandism committed Sep 2, 2014
1 parent 4dc32cc commit 6418227
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions spec/clj/speclj/cli_spec.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions src/clj/speclj/cli.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))))

0 comments on commit 6418227

Please # to comment.