-
Is there a way to find out the type of flag and if the flag is required? I would like to use this information to generate documentation. |
Beta Was this translation helpful? Give feedback.
Answered by
dearchap
Dec 22, 2023
Replies: 1 comment 6 replies
-
Have you looked at the App.ToMan() and App.ToMarkdown() functions to generate docs ? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
required is easy. You can check if
rf, ok := f.(cli.RequiredFlag); ok && rf.IsRequired()
. The type is not easy as that isnt exported anywhere. You can use the golang reflect to get the actual type and that would give you cli.BoolFlag or cli.IntFlag etc etc.