Skip to content

How do I default to time.Now() for time flags #206

Answered by alecthomas
midnightexigent asked this question in Q&A
Discussion options

You must be logged in to vote

I would use a variable for this:

var cli struct {
  Now time.Time `default:"${now}"`
}

kong.Parse(cli, kong.Vars{"now": time.Now().String()})

(off the top of my head - may need some tweaking to actually work)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by alecthomas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #205 on September 14, 2021 00:21.