Skip to content

Commit b39f7f1

Browse files
committed
add :missing, :multi, :post-validation to docstring
1 parent 9a48139 commit b39f7f1

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

.gitignore

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
target
2-
/.lein-failures
3-
/.lsp
1+
/.clj-kondo/.cache
42
/.cpcache
5-
/cljs-test-runner-out
3+
/.lein-failures
64
/.lein-repl-history
5+
/.lsp
76
/.nrepl-port
7+
/.portal
8+
/cljs-test-runner-out
9+
target

src/main/clojure/clojure/tools/cli.cljc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@
236236
;;
237237

238238
(def ^{:private true} spec-keys
239-
[:id :short-opt :long-opt :required :desc :default :default-desc :default-fn
239+
[:id :short-opt :long-opt :required :desc
240+
:default :default-desc :default-fn
240241
:parse-fn :assoc-fn :update-fn :multi :post-validation
241242
:validate-fn :validate-msg :missing])
242243

@@ -608,6 +609,9 @@
608609
boolean toggle that is set to true when specified on the
609610
command line.
610611
612+
:missing Indicates that this option is required (not just an argument),
613+
and provides the string to use as an error message if omitted.
614+
611615
:desc A optional short description of this option.
612616
613617
:default The default value of this option. If none is specified, the
@@ -707,6 +711,8 @@
707711
Regardless of :multi, you cannot specify both :assoc-fn
708712
and :update-fn for an option.
709713
714+
:multi true/false, applies only to options that use :update-fn.
715+
710716
:validate A vector of [validate-fn validate-msg ...]. Multiple pairs
711717
of validation functions and error messages may be provided.
712718
@@ -720,6 +726,11 @@
720726
failure. Can be plain strings, or functions to be applied
721727
to the (invalid) option argument to produce a string.
722728
729+
:post-validation true/false. By default, validation is performed after
730+
parsing an option, prior to assoc/default/update processing.
731+
Specifying true here will cause the validation to be
732+
performed after assoc/default/update processing, instead.
733+
723734
parse-opts returns a map with four entries:
724735
725736
{:options The options map, keyed by :id, mapped to the parsed value

0 commit comments

Comments
 (0)