github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/tm2/pkg/commands/types.go (about) 1 package commands 2 3 import "strings" 4 5 // StringArr defines the custom flag type 6 // that represents an array of string values 7 type StringArr []string 8 9 // String is a required output method for the flag 10 func (s *StringArr) String() string { 11 if len(*s) <= 0 { 12 return "..." 13 } 14 15 return strings.Join(*s, ", ") 16 } 17 18 // Set is a required output method for the flag. 19 // This is where our custom type manipulation actually happens 20 func (s *StringArr) Set(value string) error { 21 *s = append(*s, value) 22 23 return nil 24 }