cobra
cobra copied to clipboard
time.Time flags
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?
This issue is being marked as stale due to a long period of inactivity
@spf13 @bogem Any updates on this issue? I will be glad to open a PR for this feature, let me know what do you think. Thank you!
Seems like there was positive feedback on this issue and it would be relatively straight forward to support a new flag type.
This would go into https://github.com/spf13/pflag though. I'd be happy to review a PR for that if you tag me. I think that you just need to provide the ability to define the flag and the format string you expect.
Hi there... any update on this feature?
@donacarr https://github.com/spf13/pflag/pull/348 has been ready to be merged for a while now, but still waiting for review.
CC: @johnSchnake
I think this would be an awesome addition to this fantastic library, any chance we can get a review here?:
- https://github.com/spf13/pflag/pull/348