Closed geekodour closed 4 years ago
Thanks for working on this, @geekodour.
My thinking is that this isn't the right way to do this. Showing output like "--foo=false" seems quite confusing. If someone actually passes that they'll get an error:
package main
import (
"fmt"
"github.com/alecthomas/kingpin"
)
var boolFlag = kingpin.Flag("foo", "Foo").Default("true").Bool()
func main() {
kingpin.Parse()
fmt.Printf("%v\n", *boolFlag)
}
$> go run ./foo/main.go --foo=false
main: error: unexpected false, try --help
exit status 1
I think the original suggestion of showing --foo
or --no-foo
depending on the flag's default value was the right approach. It'd also be nice to change the help output to clarify this, so we'd get something like this:
--no-foo Disable the foo feature. The default is to enable this feature.
--bar Enable the bar feature. The default is to disable this feature.
The exact wording of that needs some work, since enable/disable may not work for every flag.
Yes, thanks for the PR, but I agree with @autarch. Whatever the help displays should be usable by the user.
Fixes: #243
Unsure if contradicts with kingpins design to have the implicit
--no-name
flags.cc: @autarch @alecthomas
Signed-off-by: Hrishikesh Barman hrishikeshbman@gmail.com