@@ -145,10 +145,12 @@ For detailed documentation, please see the docstring of `parse-opts`.
145
145
:update-fn inc]
146
146
[" -f" " --file NAME" " File names to read"
147
147
:multi true ; use :update-fn to combine multiple instance of -f/--file
148
- :default []
148
+ ; ; if no -f/--file options are given, return this error:
149
+ :missing " At least one file name is required"
149
150
; ; with :multi true, the :update-fn is passed both the existing parsed
150
- ; ; value(s) and the new parsed value from each option
151
- :update-fn conj]
151
+ ; ; value(s) and the new parsed value from each option; using fnil lets
152
+ ; ; us avoid specifying a :default value
153
+ :update-fn (fnil conj [])]
152
154
[" -t" nil " Timeout in seconds"
153
155
; ; Since there is no long option, we need to specify the name used for
154
156
; ; the argument to the option...
@@ -166,7 +168,9 @@ For detailed documentation, please see the docstring of `parse-opts`.
166
168
; ; for the argument that an option expects. It is only needed when the long
167
169
; ; form specification of the option is not given, only the short form. In
168
170
; ; addition, :id must be specified to provide the internal keyword name for
169
- ; ; the option. There is no way to specify that an option itself is mandatory.
171
+ ; ; the option. If you want to indicate that an option itself is required,
172
+ ; ; you can use the :missing key to provide a message that will be shown
173
+ ; ; if the option is not present.
170
174
171
175
; ; The :default values are applied first to options. Sometimes you might want
172
176
; ; to apply default values after parsing is complete, or specifically to
0 commit comments