kong icon indicating copy to clipboard operation
kong copied to clipboard

Ambiguity in understanding whether Value.Set is set from default or explicit

Open sergenyalcin opened this issue 2 years ago • 1 comments

Currently, we cannot distinguish whether we set any flags as explicit or by default. For this, I think, we may consider using a new API field in the Value struct that will present whether the flag is set to the default or not.

sergenyalcin avatar Jul 08 '23 16:07 sergenyalcin

@alecthomas Is there a workaround for this issue?

I tried defining a custom decoder and storing the value of kong.DecodeContext.Value.Set in a custom option field. But for some reason, it was always set to false in the Run method, even though Set was true in the last Decode call when the flag was passed. I couldn't figure it out, so I ended up just inspecting kong.Context.Args, which is far from ideal.

Thanks for the great library! 🙇

imiric avatar Jun 10 '25 12:06 imiric