You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{:opt []} ;; inconsistent to the non-collection version, where missing value defaults to true?
or
{:opt [true]} ;; inconsistent to the proposal for other collections, where missing value results empty collection
I don't have a strong opinion here, but I would vote for {:opt []}, keeping "empty means true" an exception exclusively limited to (non collection) booleans.
3.
The other common collections (#{}, ()) should work similarly & data type (:string, :keyword, :symbol, :int, ...) should not matter:
(cli/parse-opts [":opt"] {:coerce {:opt #{:int}}}) ;; currently throws
{:opt #{}}
4.
(cli/parse-opts [":opt""a"":opt"] {:coerce {:opt [:string]}})
{:opt ["a"]} ;; so we can't distinguish [":opt" "a" ":opt"] and [":opt" "a"]...;; alternatively we could throw in this case,;; because no acceptable value is given for one :opt (the last one in this example)
5.
The proposed functionality can be achieved by changing add-val to the following. (This is, I guess, not the most performant alternative...)
current:
expected:
{:opt []}
Notes
1.
The given example should not result
{:opt [""]}
.If
[""]
is wanted, then it is possible via:2.
current:
expected:
or
I don't have a strong opinion here, but I would vote for
{:opt []}
, keeping "empty means true" an exception exclusively limited to (non collection) booleans.3.
The other common collections (
#{}
,()
) should work similarly & data type (:string
,:keyword
,:symbol
,:int
, ...) should not matter:4.
5.
The proposed functionality can be achieved by changing add-val to the following. (This is, I guess, not the most performant alternative...)
The text was updated successfully, but these errors were encountered: