Skip to content

Commit 6418227

Browse files
committed
Treat '--speclj' as an alternative help option
1 parent 4dc32cc commit 6418227

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

spec/clj/speclj/cli_spec.clj

+9
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@
5959
(should= 0 (run "--help"))
6060
(should-not= -1 (.indexOf (to-s @output) "Usage")))
6161

62+
(it "parses the --speclj switch"
63+
(should= nil (:speclj (parse-args "")))
64+
(should= "on" (:speclj (parse-args "--speclj")))
65+
(should= "on" (:speclj (parse-args "-S"))))
66+
67+
(it "handles the --speclj switch"
68+
(should= 0 (run "--speclj"))
69+
(should-not= -1 (.indexOf (to-s @output) "Usage")))
70+
6271
(it "parses and translates the --autotest option"
6372
(let [options (parse-args "--autotest")]
6473
(should= "vigilant" (:runner options))

src/clj/speclj/cli.clj

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
(.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.")
3131
(.addSwitchOption "v" "version" "Shows the current speclj version.")
3232
(.addSwitchOption "h" "help" "You're looking at it.")
33-
)
33+
(.addSwitchOption "S" "speclj" "You're looking at it."))
3434

3535
(defn- resolve-runner-alias [name]
3636
(cond
@@ -97,6 +97,6 @@
9797
(cond
9898
(:*errors config) (usage (:*errors config))
9999
(:version config) (do (print-version) 0)
100-
(:help config) (usage nil)
100+
(or (:speclj config) (:help config)) (usage nil)
101101
:else (or (do-specs config) 0))))
102102

0 commit comments

Comments
 (0)