Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:parse function is not called as per description ? #7

Open
ieugen opened this issue May 12, 2024 · 0 comments
Open

:parse function is not called as per description ? #7

ieugen opened this issue May 12, 2024 · 0 comments

Comments

@ieugen
Copy link

ieugen commented May 12, 2024

Hello,

I've noticed that :parse is not called for the default value.

I have a definision like:

(defn parse-duration  [duration] (Duration/parse duration))

            "--duration DURATION" {:doc (str "Optional: amount of time the certificate should be valid for."
                                             "Valid time units are seconds: 's', minutes: 'm', hours: 'h'")
                                   :default "8760h0m0s"
                                   :parse time/parse-duration}

Parse is not called as per documentation.
I get the string value.

If you have a :default which is a string, and you have a :parse function, then the default will be run through parse as well. It's generally best to set the default to a string or a number, this will look better in the help text, where we show the default.

To fix things, I have to use:

:default (parse-duration "8760h0m0s")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant