-
Notifications
You must be signed in to change notification settings - Fork 2
/
menu.go
38 lines (32 loc) · 944 Bytes
/
menu.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
import (
"bufio"
"fmt"
"log"
"os"
"strconv"
"strings"
"github.com/harrisonhesslink/pythia/network"
)
// inputHandler This is a basic input loop that listens for
// a few words that correspond to functions in the app. When
// a command isn't understood, it displays the help menu and
// returns to listening to input.
func inputHandler(s *network.Server /*keyCollection *ED25519Keys*/) {
reader := bufio.NewReader(os.Stdin)
for {
fmt.Print("#> " + "\n")
text, _ := reader.ReadString('\n')
text = strings.TrimSpace(text)
if strings.Compare("help", text) == 0 {
// menu()
} else if strings.Compare("dag", text) == 0 {
count := s.P2p.Database.GetDAGSize()
log.Println("Transactions on Network: " + strconv.Itoa(count))
} else if strings.Compare("mempool", text) == 0 {
s.P2p.Mempool.PrintMemPool()
} else if strings.Compare("create_contract", text) == 0 {
go s.P2p.CreateContract()
}
}
}