aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/console/js.go24
-rw-r--r--cmd/console/main.go11
2 files changed, 30 insertions, 5 deletions
diff --git a/cmd/console/js.go b/cmd/console/js.go
index a5fdaacc2..bda58be4d 100644
--- a/cmd/console/js.go
+++ b/cmd/console/js.go
@@ -30,6 +30,7 @@ import (
"sort"
+ "github.com/codegangsta/cli"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common/docserver"
re "github.com/ethereum/go-ethereum/jsre"
@@ -329,7 +330,28 @@ func (self *jsre) welcome(ipcpath string) {
}
}
-func (self *jsre) interactive() {
+func (self *jsre) batch(args cli.Args) {
+ statement := strings.Join(args, " ")
+
+ val, err := self.re.Run(statement)
+
+ if err != nil {
+ fmt.Printf("error: %v", err)
+ } else if val.IsDefined() {
+ fmt.Printf("%v", val)
+ }
+
+ if self.atexit != nil {
+ self.atexit()
+ }
+
+ self.re.Stop(false)
+
+}
+
+func (self *jsre) interactive(ipcpath string) {
+ self.welcome(ipcpath)
+
// Read input lines.
prompt := make(chan string)
inputln := make(chan string)
diff --git a/cmd/console/main.go b/cmd/console/main.go
index e8dd412ba..00a9ca9c4 100644
--- a/cmd/console/main.go
+++ b/cmd/console/main.go
@@ -40,7 +40,7 @@ const (
var (
gitCommit string // set via linker flag
nodeNameVersion string
- app = utils.NewApp(Version, "the ether console")
+ app = utils.NewApp(Version, "the geth console")
)
func init() {
@@ -93,8 +93,11 @@ func main() {
func run(ctx *cli.Context) {
jspath := ctx.GlobalString(utils.JSpathFlag.Name)
ipcpath := utils.IpcSocketPath(ctx)
-
repl := newJSRE(jspath, ipcpath)
- repl.welcome(ipcpath)
- repl.interactive()
+
+ if ctx.Args().Present() {
+ repl.batch(ctx.Args())
+ } else {
+ repl.interactive(ipcpath)
+ }
}
mp;id=da7ef153a2a5c31e73c5e0ffab604c4b84608e00'>Convert to new options.wxs2013-01-091-28/+18 * Update to 1.1.0wxs2013-01-097-630/+193 * - Update to 1.4.22sylvio2013-01-082-31/+34 * - update to 1.0.22jgh2013-01-082-9/+9 * Convert dhn's ports to the new options frameworkbapt2013-01-082-42/+33 * - Change OPTIONS to new format.sylvio2013-01-071-4/+6 * - Update DESKTOP_ENTRIES:makc2013-01-073-12/+7 * Convert jlaffayes's ports to new options frameworkbapt2013-01-071-10/+7 * - Update to 19.20111121mva2013-01-064-42/+142 * A fork of the original MPD (Music Player Daemon) client library writtenrene2013-01-045-0/+55 * Make OSS audio work out of the boxcrees2013-01-041-0/+8 * Add missing directories for musicpd to work out of the boxcrees2013-01-033-12/+11 * Introducing baresip 0.4.2, along with the same versions of libre and librem.crees2013-01-038-31/+12 * Fix build with clang.rene2013-01-021-0/+2 * Use PORT_OPTIONS:MDOCS instead of NOPORTDOCSbapt2012-12-311-6/+4 * Use PORT_OPTIONS:MDOCS instead of NOPORTDOCSbapt2012-12-311-6/+3 * Use PORT_OPTIONS:MDOCS instead of NOPORTDOCSbapt2012-12-311-6/+3 * Use PORT_OPTIONS for both EXAMPLES and DOCSbapt2012-12-311-7/+5 * Use PORT_OPTIONS:MDOCS instead of NOPORTDOCSbapt2012-12-311-6/+3 * Use PORT_OPTIONS:MDOCS instead of NOPORTDOCSbapt2012-12-311-1/+1 * Use PORT_OPTIONS:MDOCS instead of NOPORTDOCSbapt2012-12-311-6/+4 * Use PORT_OPTIONS:MDOCS instead of NOPORTDOCSbapt2012-12-311-6/+3 * Use PORT_OPTIONS:MDOCS instead of NOPORTDOCSbapt2012-12-311-8/+3 * Use PORT_OPTIONS:MDOCS instead of NOPORTDOCSbapt2012-12-311-8/+4 * - Trim headersbapt2012-12-312-7/+2 * - Trim headersbapt2012-12-312-12/+7 * - Convert to OptionsNG frameworkmva2012-12-315-66/+79 * Bump PORTREVISION for Thunar related portsolivierd2012-12-311-1/+1 * Bump PORTREVISION for libexo-related portsolivierd2012-12-312-3/+3 * - Deprecate QT3, KDE3 and unmaintained ports depending on them. QT 3.3.8beat2012-12-3016-0/+48 * Convert romain's ports to new option frameworkbapt2012-12-301-8/+5 * - Convert to new options frameworkbapt2012-12-301-34/+29 * - Convert to new options frameworkbapt2012-12-301-22/+18 * -Update to new headermezz2012-12-302-31/+25 * The libesd use hardcoded socket-io timeout = 100ms. This is too small formezz2012-12-292-0/+63 * - restore CFLAGS/LDFLAGS to not be hardcodedjgh2012-12-292-9/+11 * - restore CFLAGS/LDFLAGS ( won't build without clobbering )jgh2012-12-291-2/+2 * Update to 12.12.25pawel2012-12-292-6/+5 * - Fix MIDI supportmva2012-12-282-6/+16 * - Fix MIDI support for Timidity and Timidity++mva2012-12-282-32/+50 * - update to 2012.12.01jgh2012-12-272-10/+6 * Bump PORTREVISION for keybinder-related portsolivierd2012-12-261-2/+2 * xfce4-mixer needs multimedia/gstreamer-plugins-good to access any OSS devices.olivierd2012-12-261-2/+2 * * fix on amd64 by forcing to always use the i686 versiondb2012-12-262-11/+10 * Patch pixmaps path to fix broken chain icons in xfce4-mixer.ehaupt2012-12-251-2/+3 * List all tested future versions in PORTSCOUT which either segfault or don't runehaupt2012-12-231-2/+2 * PyAudio provides Python bindings for PortAudio, the cross-platformmva2012-12-226-0/+110 * Remove accidentally introduced whitespace in PORTSCOUT enumeration.ehaupt2012-12-211-1/+1 * Update PORTSCOUTehaupt2012-12-211-2/+2 * - Update to version 1.6.3pawel2012-12-213-92/+31 * - Update PORTSCOUTehaupt2012-12-201-7/+3 * - Update The Glorious Glasgow Haskell Compiler to version 7.4.2pgj2012-12-206-24/+10 * - update to 3.3.1rm2012-12-203-14/+4 * - Update to 1.15.1mva2012-12-194-19/+9 * DeforaOS desktop audio mixerbapt2012-12-194-0/+35 * Chase icu, graphite2 and libexttextcat bumpbapt2012-12-191-0/+1 * Convert to OptionsNG and trim Makefile headers.naddy2012-12-196-38/+33 * Update to 0.1.6. Minor fixes only.naddy2012-12-192-4/+3 * update multimedia/audacious to 3.3.3oliver2012-12-182-4/+3 * Convert to new options.wxs2012-12-181-31/+25 * Convert to new options.wxs2012-12-181-21/+15 * The NLS logic was inverted, so fix it.wxs2012-12-18