Skip to content

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

@ieugen

Description

@ieugen

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")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions