Permalink
Browse files

Merge pull request #102 from mirtchovski/test-harness

keep -help intact for callers
  • Loading branch information...
2 parents 292a02d + ac8dba9 commit 65914b3074bcef5c6b2b3e3fcff1af74a879b9fc @skelterjohn skelterjohn committed Aug 17, 2012
Showing with 12 additions and 2 deletions.
  1. +12 −2 config.go
View
@@ -141,8 +141,13 @@ func GetClientConfigFromFlags(argv ...string) (config *ClientConfig, args []stri
argv = os.Args[1:]
}
- flagset.Parse(argv)
+ err := flagset.Parse(argv)
args = flagset.Args()
+ if err != nil {
+ // -help was given, pass it on to caller who
+ // may decide to quit instead of continuing
+ args = append(args, "-help")
+ }
config.IdleTimeout = time.Duration(*idleTimeout)
@@ -168,8 +173,13 @@ func GetServiceConfigFromFlags(argv ...string) (config *ServiceConfig, args []st
if len(argv) == 0 {
argv = os.Args[1:]
}
- flagset.Parse(argv)
+ err := flagset.Parse(argv)
args = flagset.Args()
+ if err != nil {
+ // -help was given, pass it on to caller who
+ // may decide to quit instead of continuing
+ args = append(args, "-help")
+ }
rpcBA, err := BindAddrFromString(*rpcAddr)
if err != nil {

0 comments on commit 65914b3

Please sign in to comment.