How to check if any flag was set ? #920
Labels
area/flags-args
Changes to functionality around command line flags and args
kind/support
Questions, supporting users, etc.
I have CLI program I wrote in Go.
I have something like 20 flags.
Is there a way to check if non of the flags were assigned?
Something similar to
len(args) < 0
?I saw that there is the
Changed
function:flagset := cmd.Flags()
flagset.Changed()
But I need to provide the name of the flag and I don't want to specify all the 20 flags.
I saw that there is
orderedActual
that has the flags that were set so if I could just runlen(orderedActual)
it could be great, but I can't because it is private variable.The text was updated successfully, but these errors were encountered: