CODE: add an ARGV processing example
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
21a050c953
commit
478750e2dd
1
Makefile
1
Makefile
|
@ -32,6 +32,7 @@ build:
|
||||||
cd example-ssh; go install # scp example
|
cd example-ssh; go install # scp example
|
||||||
|
|
||||||
# golang things
|
# golang things
|
||||||
|
cd example-flag; go install # process argv
|
||||||
cd example-pprof; go install # dump out go process internals
|
cd example-pprof; go install # dump out go process internals
|
||||||
cd example-bench-fast-timer; go install # time golang channels
|
cd example-bench-fast-timer; go install # time golang channels
|
||||||
cd example-bench-readWriteOps; go install #
|
cd example-bench-readWriteOps; go install #
|
||||||
|
|
|
@ -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)
|
||||||
|
}
|
Loading…
Reference in New Issue