Skip to content
Snippets Groups Projects
Verified Commit a680bb80 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: handle values from type flags.Bool

parent 2728224f
No related branches found
No related tags found
No related merge requests found
......@@ -32,9 +32,9 @@ func TestGetHelp(t *testing.T) {
args []string
substring string
}{
{"test1", []string{"sub1", "--help"}, "Usage: test1 sub1 [global options] [command] [arguments]"},
{"test1", []string{"xsd", "help"}, "Usage: test1 [global options] [command] [arguments]"},
{"test2", []string{"sub1", "sub2"}, "Usage: test2 sub1 sub2 [global options] [command] [arguments]"},
{"test1", []string{"sub1", "--help"}, "Usage: [global options] [command] [arguments]\n\nGlobal Options:\n -a\tMessage A\n -x int\n \tMessage X\n\nCommand: sub1\n\nOptions:\n -b\tMessage B\n"},
{"test1", []string{"xsd", "help"}, "Usage: [global options] [command] [arguments]\n\nGlobal Options:\n -a\tMessage A\n -x int\n \tMessage X\n\nCommand: sub1\n\nOptions:\n -b\tMessage B\n"},
{"test2", []string{"sub1", "sub2"}, "Usage: [global options] [command] [arguments]\n\nGlobal Options:\n -a\tMessage A\n -x int\n \tMessage X\n\nCommand: sub1\n\nOptions:\n -b\tMessage B\n"},
}
for _, table := range tables {
......
......@@ -37,7 +37,7 @@ func (s *Settings[C]) assignValues(c cmd[C]) {
flgs.Visit(func(f *flag.Flag) {
name := f.Name
value := f.Value //.String()
value := f.Value.String()
k, ok := c.tagMapping[name]
if !ok {
......
package xflags
import "strings"
import (
"fmt"
"strings"
)
type StringFlags []string
......@@ -18,7 +21,7 @@ type IntFlags []int
func (i *IntFlags) String() string {
r := make([]string, len(*i))
for k, v := range *i {
r[k] = string(v)
r[k] = fmt.Sprintf("%c", v)
}
return strings.Join(r, ",")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment