Closed chrjen closed 3 years ago
From https://pkg.go.dev/github.com/mkideal/cli?utm_source=godoc#Context.IsSet:
IsSet
determins whetherflag
is set
I.e., it is meant to work for the "flag
" option, not the normal options as shown in OP.
For example of the "flag
" option, see:
https://github.com/suntong/lang/tree/master/lang/Go/src/sys/cli#002-flaggo
See also #31, which is yet to be implemented.
Preappend double ‘-‘ to long flag name, one ‘-‘ to short flag name, e.g.
ctx.IsSet(“—name”) ctx.IsSet(“-v”)
Sent from my iPhone
On Aug 10, 2021, at 16:21, Christer Jensen @.***> wrote:
ctx.IsSet("time"))
Thank you! Yes, that seems to work.
v0.2.7, although using previous versions didn't seem to help.
I'm trying to figure out if a flag is present or not as I only want to use the value if it was specified. I tried using
IsSet
though it doesn't seem to work. Example program,Output:
Shouldn't
IsSet
return true here? The problem seems to be becausectx.flagSet.flagMap
is always empty.