diff --git a/ethereal/flags.go b/ethereal/flags.go index 18f55071a..5975439c9 100644 --- a/ethereal/flags.go +++ b/ethereal/flags.go @@ -1,7 +1,15 @@ package main import ( + "fmt" + "os" + "os/user" + "path" + "github.com/ethereum/eth-go/ethlog" "flag" + "bitbucket.org/kardianos/osext" + "path/filepath" + "runtime" ) var Identifier string @@ -59,6 +67,11 @@ func defaultDataDir() string { var defaultConfigFile = path.Join(defaultDataDir(), "conf.ini") func Init() { + flag.Usage = func() { + fmt.Fprintf(os.Stderr, "%s [options] [filename]:\noptions precedence: default < config file < environment variables < command line", os.Args[0]) + flag.PrintDefaults() + } + flag.StringVar(&Identifier, "id", "", "Custom client identifier") flag.StringVar(&OutboundPort, "port", "30303", "listening port") flag.BoolVar(&UseUPnP, "upnp", false, "enable UPnP support") @@ -75,7 +88,7 @@ func Init() { flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file") flag.StringVar(&DebugFile, "debug", "", "debug file (no debugging if not set)") flag.IntVar(&LogLevel, "loglevel", int(ethlog.InfoLevel), "loglevel: 0-4: silent,error,warn,info,debug)") - flag.StringVar(&AssetPath, "asset_path", defaultAssetPath, "absolute path to GUI assets directory") + flag.StringVar(&AssetPath, "asset_path", defaultAssetPath(), "absolute path to GUI assets directory") flag.Parse() } diff --git a/ethereal/main.go b/ethereal/main.go index 4af068197..10571be7b 100644 --- a/ethereal/main.go +++ b/ethereal/main.go @@ -1,15 +1,12 @@ package main import ( - "fmt" "github.com/ethereum/go-ethereum/ethereal/ui" "github.com/ethereum/go-ethereum/utils" "github.com/go-qml/qml" "runtime" ) -const Debug = true - func main() { qml.Init(nil) @@ -38,6 +35,6 @@ func main() { utils.StartEthereum(ethereum, UseSeed) - gui := ethui.New(ethereum, logLevel) + gui := ethui.New(ethereum, LogLevel) gui.Start(AssetPath) } diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go index ed29e2485..f3a918ea0 100644 --- a/ethereal/ui/gui.go +++ b/ethereal/ui/gui.go @@ -40,7 +40,7 @@ type Gui struct { } // Create GUI, but doesn't start it -func New(ethereum *eth.Ethereum, logLevel ethlog.LogLevel) *Gui { +func New(ethereum *eth.Ethereum, logLevel int) *Gui { lib := &EthLib{stateManager: ethereum.StateManager(), blockChain: ethereum.BlockChain(), txPool: ethereum.TxPool()} db, err := ethdb.NewLDBDatabase("tx_database") if err != nil { @@ -56,7 +56,7 @@ func New(ethereum *eth.Ethereum, logLevel ethlog.LogLevel) *Gui { pub := ethpub.NewPEthereum(ethereum) - return &Gui{eth: ethereum, lib: lib, txDb: db, addr: addr, pub: pub, logLevel: logLevel} + return &Gui{eth: ethereum, lib: lib, txDb: db, addr: addr, pub: pub, logLevel: ethlog.LogLevel(logLevel)} } func (gui *Gui) Start(assetPath string) { diff --git a/ethereal/ui/ui_lib.go b/ethereal/ui/ui_lib.go index 156d55157..5f6a9ef0b 100644 --- a/ethereal/ui/ui_lib.go +++ b/ethereal/ui/ui_lib.go @@ -1,14 +1,10 @@ package ethui import ( - "bitbucket.org/kardianos/osext" "github.com/ethereum/eth-go" "github.com/ethereum/eth-go/ethutil" "github.com/go-qml/qml" - "os" "path" - "path/filepath" - "runtime" ) type memAddr struct {