Use new Tag type for slice separator.
This commit is contained in:
@@ -118,6 +118,7 @@ func buildNode(v reflect.Value, seenFlags map[string]bool, cmd bool) *Node {
|
||||
Help: tag.Help,
|
||||
Default: tag.Default,
|
||||
Decoder: decoder,
|
||||
Tag: tag,
|
||||
Value: fv,
|
||||
|
||||
// Flags are optional by default, and args are required by default.
|
||||
|
||||
+1
-1
@@ -222,7 +222,7 @@ func floatDecoder(bits int) DecoderFunc {
|
||||
|
||||
func sliceDecoder(ctx *DecoderContext, scan *Scanner, target reflect.Value) error {
|
||||
el := target.Type().Elem()
|
||||
sep, ok := ctx.Value.Tag.Lookup("sep")
|
||||
sep, ok := ctx.Value.Tag.Get("sep")
|
||||
if !ok {
|
||||
sep = ","
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ type Value struct {
|
||||
Help string
|
||||
Default string
|
||||
Decoder Decoder
|
||||
Tag reflect.StructTag
|
||||
Tag *Tag
|
||||
Value reflect.Value
|
||||
Required bool
|
||||
Set bool // Used with Required to test if a value has been given.
|
||||
|
||||
Reference in New Issue
Block a user