aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/ethereum/repl/repl_windows.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-03-06 10:38:19 +0800
committerFelix Lange <fjl@twurst.com>2015-03-06 10:57:13 +0800
commit38f6d60e6e699db24b7a850b5999823b9e36d5bb (patch)
treee29709adf03982aeb8e5d61c40b1e37399a2fd4e /cmd/ethereum/repl/repl_windows.go
parentbae7e93a9c5af679682f89b0f475e98c1eee9e58 (diff)
downloaddexon-38f6d60e6e699db24b7a850b5999823b9e36d5bb.tar
dexon-38f6d60e6e699db24b7a850b5999823b9e36d5bb.tar.gz
dexon-38f6d60e6e699db24b7a850b5999823b9e36d5bb.tar.bz2
dexon-38f6d60e6e699db24b7a850b5999823b9e36d5bb.tar.lz
dexon-38f6d60e6e699db24b7a850b5999823b9e36d5bb.tar.xz
dexon-38f6d60e6e699db24b7a850b5999823b9e36d5bb.tar.zst
dexon-38f6d60e6e699db24b7a850b5999823b9e36d5bb.zip
cmd/ethereum: new JS repl with cross-platform line editing
Diffstat (limited to 'cmd/ethereum/repl/repl_windows.go')
-rw-r--r--cmd/ethereum/repl/repl_windows.go92
1 files changed, 0 insertions, 92 deletions
diff --git a/cmd/ethereum/repl/repl_windows.go b/cmd/ethereum/repl/repl_windows.go
deleted file mode 100644
index d2c405ee9..000000000
--- a/cmd/ethereum/repl/repl_windows.go
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-// MA 02110-1301 USA
-
-package ethrepl
-
-import (
- "bufio"
- "fmt"
- "os"
- "strings"
-)
-
-func (self *JSRepl) read() {
- reader := bufio.NewReader(os.Stdin)
- for {
- fmt.Printf(self.prompt)
- str, _, err := reader.ReadLine()
- if err != nil {
- fmt.Println("Error reading input", err)
- } else {
- if string(str) == "exit" {
- self.Stop()
- break
- } else {
- self.parseInput(string(str))
- }
- }
- }
-}
-
-func addHistory(s string) {
-}
-
-func printColored(outputVal string) {
- for outputVal != "" {
- codePart := ""
- if strings.HasPrefix(outputVal, "\033[32m") {
- codePart = "\033[32m"
- changeColor(2)
- }
- if strings.HasPrefix(outputVal, "\033[1m\033[30m") {
- codePart = "\033[1m\033[30m"
- changeColor(8)
- }
- if strings.HasPrefix(outputVal, "\033[31m") {
- codePart = "\033[31m"
- changeColor(red)
- }
- if strings.HasPrefix(outputVal, "\033[35m") {
- codePart = "\033[35m"
- changeColor(5)
- }
- if strings.HasPrefix(outputVal, "\033[0m") {
- codePart = "\033[0m"
- resetColorful()
- }
- textPart := outputVal[len(codePart):len(outputVal)]
- index := strings.Index(textPart, "\033")
- if index == -1 {
- outputVal = ""
- } else {
- outputVal = textPart[index:len(textPart)]
- textPart = textPart[0:index]
- }
- fmt.Printf("%v", textPart)
- }
-}
-
-func (self *JSRepl) PrintValue(v interface{}) {
- method, _ := self.re.Vm.Get("prettyPrint")
- v, err := self.re.Vm.ToValue(v)
- if err == nil {
- val, err := method.Call(method, v)
- if err == nil {
- printColored(fmt.Sprintf("%v", val))
- }
- }
-}