fix flag parsing -- use flagSet after the command

This commit is contained in:
Jae Kwon
2014-12-28 15:08:07 -08:00
parent 1d5a6065c5
commit c6c465402e
2 changed files with 17 additions and 17 deletions

View File

@ -1,18 +1,15 @@
package main
import (
"flag"
"fmt"
"os"
"github.com/tendermint/tendermint/config"
)
func main() {
// Parse config flags
config.ParseFlags()
args := flag.Args()
args := os.Args[1:]
if len(args) == 0 {
fmt.Println(`Tendermint
@ -21,13 +18,13 @@ Commands:
gen_account Generate new account keypair
gen_validator Generate new validator keypair
probe_upnp Test UPnP functionality
tendermint --help for command options`)
`)
return
}
switch args[0] {
case "daemon":
config.ParseFlags(args[1:])
daemon()
case "gen_account":
gen_account()
@ -35,5 +32,7 @@ tendermint --help for command options`)
gen_validator()
case "probe_upnp":
probe_upnp()
default:
fmt.Println("Unknown command %v", args[0])
}
}