Skip to content

time.Time flags #742

@lesovsky

Description

@lesovsky

Hi,

Is there simple way to handle time flags? For example, I use the following flags in my cli:

./a.out --start="2018-09-08 12:00:00" --end="2018-09-09 12:00:00"

I have not found according functions in go doc, and use the following workaround: I save start/end values using StringVarP and then define layout and parse strings with time.Parse.

Does cobra provide functions for handling time flags?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/flags-argsChanges to functionality around command line flags and argskind/featureA feature request for cobra; new or enhanced behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions