This commit is contained in:
Mark McGranaghan
2012-09-23 17:49:22 -07:00
parent e4b083d49b
commit d7045c962c
49 changed files with 2 additions and 47 deletions

View File

@@ -0,0 +1,21 @@
// ## Command Line Flags
package main
import "flag"
import "fmt"
func main() {
maxp := flag.Int("repeat", 3, "time to repeat args")
flag.Parse()
for i := 0; i < *maxp; i++ {
for _, arg := range flag.Args() {
fmt.Println(arg)
}
}
}
// todo: multiple flags
// todo: trailing args
// todo: arg escaping
// todo: help text and usage errors