diff --git a/Makefile b/Makefile index cc629d6..a414fff 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,7 @@ build: cd example-ssh; go install # scp example # golang things + cd example-flag; go install # process argv cd example-pprof; go install # dump out go process internals cd example-bench-fast-timer; go install # time golang channels cd example-bench-readWriteOps; go install # diff --git a/example-flag/flag.go b/example-flag/flag.go new file mode 100644 index 0000000..56d65ef --- /dev/null +++ b/example-flag/flag.go @@ -0,0 +1,26 @@ +package main + +import ( + "flag" + "fmt" + "time" + + "github.com/google/goterm/term" +) + +const ( + timeout = 10 * time.Minute +) + +var ( + addr = flag.String("address", "", "address of telnet server") + user = flag.String("user", "user", "username to use") + pass1 = flag.String("pass1", "pass1", "password to use") + pass2 = flag.String("pass2", "pass2", "alternate password to use") +) + +func main() { + flag.Parse() + fmt.Println(term.Bluef("flag Example")) + fmt.Println("addr=",addr) +}