diff options
author | Felix Lange <fjl@twurst.com> | 2015-03-18 04:15:23 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-03-18 04:15:23 +0800 |
commit | 786a58d8b0188700edec824f74606a3980132f50 (patch) | |
tree | cf247ed9ca2038e9a11d000ad03b2c75b9056195 /cmd/ethereum/main.go | |
parent | 9663493ba0d493ec62153e725b5d30340f2aa525 (diff) | |
parent | 17cd7a5817ce4acbfb85ebe1977952027167bd1c (diff) | |
download | go-tangerine-786a58d8b0188700edec824f74606a3980132f50.tar go-tangerine-786a58d8b0188700edec824f74606a3980132f50.tar.gz go-tangerine-786a58d8b0188700edec824f74606a3980132f50.tar.bz2 go-tangerine-786a58d8b0188700edec824f74606a3980132f50.tar.lz go-tangerine-786a58d8b0188700edec824f74606a3980132f50.tar.xz go-tangerine-786a58d8b0188700edec824f74606a3980132f50.tar.zst go-tangerine-786a58d8b0188700edec824f74606a3980132f50.zip |
Merge pull request #485 from ethersphere/frontier/nodeadmin.js
Frontier console node admin interface
Diffstat (limited to 'cmd/ethereum/main.go')
-rw-r--r-- | cmd/ethereum/main.go | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 1efea927f..64b9949d2 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -31,9 +31,9 @@ import ( "github.com/codegangsta/cli" "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/state" "github.com/peterh/liner" @@ -89,16 +89,20 @@ Use "ethereum dump 0" to dump the genesis block. `, }, { - Action: runjs, + Action: console, + Name: "console", + Usage: `Ethereum Console: interactive JavaScript environment`, + Description: ` +Console is an interactive shell for the Ethereum JavaScript runtime environment which exposes a node admin interface as well as the DAPP JavaScript API. +See https://github.com/ethereum/go-ethereum/wiki/Frontier-Console +`, + }, + { + Action: execJSFiles, Name: "js", - Usage: `interactive JavaScript console`, + Usage: `executes the given JavaScript files in the Ethereum Frontier JavaScript VM`, Description: ` -In the console, you can use the eth object to interact -with the running ethereum stack. The API does not match -ethereum.js. - -A JavaScript file can be provided as the argument. The -runtime will execute the file and exit. +The Ethereum JavaScript VM exposes a node admin interface as well as the DAPP JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Frontier-Console `, }, { @@ -116,6 +120,7 @@ runtime will execute the file and exit. utils.UnlockedAccountFlag, utils.BootnodesFlag, utils.DataDirFlag, + utils.JSpathFlag, utils.ListenPortFlag, utils.LogFileFlag, utils.LogFormatFlag, @@ -131,6 +136,7 @@ runtime will execute the file and exit. utils.RPCPortFlag, utils.UnencryptedKeysFlag, utils.VMDebugFlag, + //utils.VMTypeFlag, } @@ -168,7 +174,7 @@ func run(ctx *cli.Context) { ethereum.WaitForShutdown() } -func runjs(ctx *cli.Context) { +func console(ctx *cli.Context) { cfg := utils.MakeEthConfig(ClientIdentifier, Version, ctx) ethereum, err := eth.New(cfg) if err != nil { @@ -176,14 +182,26 @@ func runjs(ctx *cli.Context) { } startEth(ctx, ethereum) - repl := newJSRE(ethereum) - if len(ctx.Args()) == 0 { - repl.interactive() - } else { - for _, file := range ctx.Args() { - repl.exec(file) - } + repl := newJSRE(ethereum, ctx.String(utils.JSpathFlag.Name)) + repl.interactive() + + ethereum.Stop() + ethereum.WaitForShutdown() +} + +func execJSFiles(ctx *cli.Context) { + cfg := utils.MakeEthConfig(ClientIdentifier, Version, ctx) + ethereum, err := eth.New(cfg) + if err != nil { + utils.Fatalf("%v", err) } + + startEth(ctx, ethereum) + repl := newJSRE(ethereum, ctx.String(utils.JSpathFlag.Name)) + for _, file := range ctx.Args() { + repl.exec(file) + } + ethereum.Stop() ethereum.WaitForShutdown() } |