Closed chrjen closed 3 years ago
Version: 0.2.7
The value Hello, %s! as a default value seems to be treated as a format string when it really should just be printed as is.
Hello, %s!
Example code:
package main import ( "fmt" "os" "github.com/mkideal/cli" ) type argT struct { Format string `cli:"f,format" dft:"Hello, %s!" usage:"format for greeting"` } func main() { os.Exit(cli.Run(new(argT), func(ctx *cli.Context) error { argv := ctx.Argv().(*argT) fmt.Println(argv.Format) fmt.Println("==================") ctx.WriteUsage() return nil })) }
Expected output:
Hello, %s! ================== Options: -f, --format[=Hello, %s!] format for greeting
Actual output:
Hello, %s! ================== Options: -f, --format[=Hello, %!s(MISSING)!] format for greeting
It prints out Hello, %!s(MISSING)! instead.
Hello, %!s(MISSING)!
Version: 0.2.7
The value
Hello, %s!
as a default value seems to be treated as a format string when it really should just be printed as is.Example code:
Expected output:
Actual output:
It prints out
Hello, %!s(MISSING)!
instead.