Closed fatbrain closed 8 years ago
Note the (contains default value)
.
isSet
is true only if you input the flag in ternminal.
isAssigned
is if you input the flag in terminal or the flag has defaut value.
type argT struct {
A int `cli:"a" dft:"2"`
B int `cli:"b"`
}
# flag(-a).isAssigned=flag(-a).isSet=true
# flag(-b).isAssigned=flag(-b).isSet=false
$ ./app -a 1
# flag(-a).isAssigned=flag(-a).isSet=true
# flag(-b).isAssigned=flag(-b).isSet=true
$ ./app -a 1 -b 2
# flag(-a).isAssigned=true, flag(-a).isSet=false
# flag(-b).isAssigned=flag(-b).isSet=true
$ ./app -b 2
ctx.IsSet
is wrong! 😫😢
Not very intuitive. From the code (both comments makes reference to same field, copy and paste gone awry?)
Cheers, J