-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
area/v2relates to / is being considered for v2relates to / is being considered for v2kind/questionsomeone asking a questionsomeone asking a questionstatus/claimedsomeone has claimed this issuesomeone has claimed this issuestatus/triagemaintainers still need to look into thismaintainers still need to look into this
Description
test.yaml
scope:
test:
- test1
- test2
test:
temp:
test: 1
testYaml.go
func main() {
flags := []cli.Flag{
&cli.StringFlag{
Name: "config",
Usage: "yaml config file name",
},
altsrc.NewUint64Flag(
&cli.Uint64Flag{
Name: "test.temp.test",
Aliases: []string{},
Value: 0,
Destination: &test,
},
),
altsrc.NewStringSliceFlag(
&cli.StringSliceFlag{
Name: "scope.test",
Aliases: []string{},
EnvVars: []string{},
},
),
}
app := &cli.App{
Flags: flags,
Before: altsrc.InitInputSourceWithContext(flags, altsrc.NewYamlSourceFromFlagFunc("config")),
Action: func(ctx *cli.Context) error {
if ctx.IsSet("scope.test") {
fmt.Println("true", ctx.StringSlice("scope.test"))
} else {
fmt.Println("false", ctx.StringSlice("scope.test"))
}
if ctx.IsSet("test.temp.test") {
fmt.Println("true", ctx.Uint64("test.temp.test") {
} else {
fmt.Println("false", ctx.Uint64("test.temp.test")
}
return nil
},
}
fmt.Println(app.Run(os.Args))
}
-
Expected Result
- scope.test : true [test1 test2]
- test.temp.test : true 1
-
Result
- scope.test : false [test1 test2]
- test.temp.test : false 0
-
Reason
- slice : not setting flagSet (https://github.com/urfave/cli/blob/v2-maint/altsrc/flag.go#L114)
- Uint64: there is no receiver function for Uint64 (https://github.com/urfave/cli/blob/v2-maint/altsrc/flag.go#L66)
Metadata
Metadata
Assignees
Labels
area/v2relates to / is being considered for v2relates to / is being considered for v2kind/questionsomeone asking a questionsomeone asking a questionstatus/claimedsomeone has claimed this issuesomeone has claimed this issuestatus/triagemaintainers still need to look into thismaintainers still need to look into this