summaryrefslogtreecommitdiffstats
path: root/prompt
diff options
context:
space:
mode:
authorbt <bt@rctt.net>2026-03-14 23:11:15 +0100
committerbt <bt@rctt.net>2026-03-18 16:21:58 +0100
commit54ddec67c477a6fd73b0f623258c0849ba695b88 (patch)
tree3a34b67e62b8788f0611abc4f9f8cfe7954aae46 /prompt
parent8932846aa4d29d59fd208f40bbfd44d1bb9cf1ff (diff)
downloadsolec-54ddec67c477a6fd73b0f623258c0849ba695b88.tar.gz
solec-54ddec67c477a6fd73b0f623258c0849ba695b88.zip
Basic server implementation
Diffstat (limited to 'prompt')
-rw-r--r--prompt/prompt.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/prompt/prompt.go b/prompt/prompt.go
new file mode 100644
index 0000000..63c2a60
--- /dev/null
+++ b/prompt/prompt.go
@@ -0,0 +1,29 @@
+package prompt
+
+import (
+ "bufio"
+ "fmt"
+ "log"
+ "os"
+ "strings"
+)
+
+var Commands = make(map[string]func(args []string))
+
+func Read() {
+ sc := bufio.NewScanner(os.Stdin)
+ for sc.Scan() {
+ args := strings.Split(sc.Text(), " ")
+
+ cmd, ok := Commands[args[0]]
+ if !ok {
+ fmt.Println("unknown command")
+ continue
+ }
+
+ cmd(args[1:])
+ }
+ if err := sc.Err(); err != nil {
+ log.Println(err)
+ }
+}