|
4 | 4 | [clojure.test :refer :all] |
5 | 5 | [lambdaisland.cli :as cli :refer :all])) |
6 | 6 |
|
7 | | -(deftest flagstr-parsing-test |
8 | | - (is (= {"--help" {:key :help :value true} |
9 | | - "-C" {:flag "-C" |
10 | | - :key :C |
11 | | - :argcnt 0 |
12 | | - :short? true |
13 | | - :description "Change working directory"} |
14 | | - "-v" {:flag "-v" |
15 | | - :key :verbose |
16 | | - :argcnt 0 |
17 | | - :short? true |
18 | | - :description "Increase verbosity"} |
19 | | - "--verbose" {:flag "--verbose" |
20 | | - :key :verbose |
21 | | - :argcnt 0 |
22 | | - :description "Increase verbosity"} |
23 | | - "-i" {:flag "-i" |
24 | | - :key :input |
25 | | - :argcnt 1 |
26 | | - :short? true |
27 | | - :args [:input-file] |
28 | | - :description "Set input file"} |
29 | | - "--input" {:flag "--input" |
30 | | - :key :input |
31 | | - :argcnt 1 |
32 | | - :args [:input-file] |
33 | | - :description "Set input file"} |
34 | | - "--output" {:flag "--output" |
35 | | - :key :output |
36 | | - :argcnt 1 |
37 | | - :args [:output-file] |
38 | | - :description "Set output file"} |
39 | | - "--capture-output" {:flag "--capture-output" |
40 | | - :key :capture-output |
41 | | - :argcnt 0 |
42 | | - :value true |
43 | | - :description "Enable/disable output capturing"} |
44 | | - "--no-capture-output" {:flag "--no-capture-output" |
45 | | - :key :capture-output |
46 | | - :argcnt 0 |
47 | | - :value false |
48 | | - :description "Enable/disable output capturing"}} |
49 | | - (parse-flagstrs ["-C" "Change working directory" |
50 | | - "-v, --verbose" "Increase verbosity" |
51 | | - "-i, --input INPUT-FILE" {:description "Set input file"} |
52 | | - "--output=<output-file>" {:description "Set output file"} |
53 | | - "--[no-]capture-output" "Enable/disable output capturing"] )))) |
| 7 | +;; (deftest flagstr-parsing-test |
| 8 | +;; (is (= {"--help" {:key :help :value true} |
| 9 | +;; "-C" {:flag "-C" |
| 10 | +;; :key :C |
| 11 | +;; :argcnt 0 |
| 12 | +;; :short? true |
| 13 | +;; :description "Change working directory"} |
| 14 | +;; "-v" {:flag "-v" |
| 15 | +;; :key :verbose |
| 16 | +;; :argcnt 0 |
| 17 | +;; :short? true |
| 18 | +;; :description "Increase verbosity"} |
| 19 | +;; "--verbose" {:flag "--verbose" |
| 20 | +;; :key :verbose |
| 21 | +;; :argcnt 0 |
| 22 | +;; :description "Increase verbosity"} |
| 23 | +;; "-i" {:flag "-i" |
| 24 | +;; :key :input |
| 25 | +;; :argcnt 1 |
| 26 | +;; :short? true |
| 27 | +;; :args [:input-file] |
| 28 | +;; :description "Set input file"} |
| 29 | +;; "--input" {:flag "--input" |
| 30 | +;; :key :input |
| 31 | +;; :argcnt 1 |
| 32 | +;; :args [:input-file] |
| 33 | +;; :description "Set input file"} |
| 34 | +;; "--output" {:flag "--output" |
| 35 | +;; :key :output |
| 36 | +;; :argcnt 1 |
| 37 | +;; :args [:output-file] |
| 38 | +;; :description "Set output file"} |
| 39 | +;; "--capture-output" {:flag "--capture-output" |
| 40 | +;; :key :capture-output |
| 41 | +;; :argcnt 0 |
| 42 | +;; :value true |
| 43 | +;; :description "Enable/disable output capturing"} |
| 44 | +;; "--no-capture-output" {:flag "--no-capture-output" |
| 45 | +;; :key :capture-output |
| 46 | +;; :argcnt 0 |
| 47 | +;; :value false |
| 48 | +;; :description "Enable/disable output capturing"}} |
| 49 | +;; (parse-flagstrs ["-C" "Change working directory" |
| 50 | +;; "-v, --verbose" "Increase verbosity" |
| 51 | +;; "-i, --input INPUT-FILE" {:description "Set input file"} |
| 52 | +;; "--output=<output-file>" {:description "Set output file"} |
| 53 | +;; "--[no-]capture-output" "Enable/disable output capturing"] )))) |
54 | 54 |
|
55 | | -(deftest command-argument-parsing |
56 | | - (is (= {"run" {:description "Run the thing" :argnames []} |
57 | | - "remove" {:description "remove with id" :argnames [:id]} |
58 | | - "add" {:description "Add with id" :argnames [:id]}} |
59 | | - (prepare-cmdmap ["run" {:description "Run the thing"} |
60 | | - "add ID" {:description "Add with id"} |
61 | | - "remove <id>" {:description "remove with id"}])))) |
| 55 | +;; (deftest command-argument-parsing |
| 56 | +;; (is (= {"run" {:description "Run the thing" :argnames []} |
| 57 | +;; "remove" {:description "remove with id" :argnames [:id]} |
| 58 | +;; "add" {:description "Add with id" :argnames [:id]}} |
| 59 | +;; (prepare-cmdmap ["run" {:description "Run the thing"} |
| 60 | +;; "add ID" {:description "Add with id"} |
| 61 | +;; "remove <id>" {:description "remove with id"}])))) |
0 commit comments