-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
57 lines (48 loc) · 1.49 KB
/
main.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from command.help import Help
from command.query import Query
from command.last import Last
from command.balance import Balance
from command.token import Token
from command.endpoint import Endpoint
from command.oracle import Oracle
from command.transactions import Transactions
from command.transaction import Transaction
from command.nodes import Nodes
from command.transactionchain import TransactionChain
from command.networktransactions import NetworkTransactions
from connection import con
import traceback
VERSION = "1.1"
commands = {
"help": Help(),
"query": Query(),
"last": Last(),
"balance": Balance(),
"token": Token(),
"endpoint": Endpoint(),
"oracle": Oracle(),
"transactions": Transactions(),
"transaction": Transaction(),
"nodes": Nodes(),
"chain": TransactionChain(),
"type": NetworkTransactions()
}
if __name__ == "__main__":
print(f"Archethic Explorer CLI {VERSION}")
print(f"https://github.com/andro2157/archethic-explorer-cli/")
print(f"Endpoint : {con.endpoint}")
while True:
try:
command = input("> ")
except KeyboardInterrupt:
break
args = command.split()
if len(args) == 0: continue
if args[0].lower() in commands:
try:
commands[args[0].lower()].userInput(args[1:])
except Exception as e:
print("Command failed.")
print(traceback.format_exc())
else:
print("Unknown command.")