Commit f4551a7e authored by obscuren's avatar obscuren

Changed flag parsing

parent 563c035e
...@@ -2,6 +2,8 @@ package main ...@@ -2,6 +2,8 @@ package main
import ( import (
"flag" "flag"
"fmt"
"os"
) )
var StartMining bool var StartMining bool
...@@ -23,6 +25,11 @@ var StartJsConsole bool ...@@ -23,6 +25,11 @@ var StartJsConsole bool
var InputFile string var InputFile string
func Init() { func Init() {
flag.Usage = func() {
fmt.Fprintf(os.Stderr, "%s [options] [filename]:\n", os.Args[0])
flag.PrintDefaults()
}
flag.BoolVar(&StartMining, "m", false, "start dagger mining") flag.BoolVar(&StartMining, "m", false, "start dagger mining")
flag.BoolVar(&ShowGenesis, "g", false, "prints genesis header and exits") flag.BoolVar(&ShowGenesis, "g", false, "prints genesis header and exits")
flag.BoolVar(&StartRpc, "r", false, "start rpc server") flag.BoolVar(&StartRpc, "r", false, "start rpc server")
...@@ -38,7 +45,9 @@ func Init() { ...@@ -38,7 +45,9 @@ func Init() {
flag.StringVar(&ImportKey, "import", "", "imports the given private key (hex)") flag.StringVar(&ImportKey, "import", "", "imports the given private key (hex)")
flag.IntVar(&MaxPeer, "x", 10, "maximum desired peers") flag.IntVar(&MaxPeer, "x", 10, "maximum desired peers")
flag.BoolVar(&StartJsConsole, "js", false, "exp") flag.BoolVar(&StartJsConsole, "js", false, "exp")
flag.StringVar(&InputFile, "e", "", "Run javascript file") //flag.StringVar(&InputFile, "e", "", "Run javascript file")
flag.Parse() flag.Parse()
InputFile = flag.Arg(0)
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment