Created
July 29, 2015 09:03
-
-
Save fujiwara/7aa8ea48dfe171e111a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
) | |
type strslice []string | |
func (s *strslice) String() string { | |
return fmt.Sprintf("%v", *s) | |
} | |
func (s *strslice) Set(v string) error { | |
*s = append(*s, v) | |
return nil | |
} | |
func main() { | |
var multiflag strslice | |
flag.Var(&multiflag, "data", "Data values.") | |
flag.Parse() | |
fmt.Printf("%v", multiflag) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment