-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtreenotes.py
More file actions
executable file
·42 lines (33 loc) · 814 Bytes
/
treenotes.py
File metadata and controls
executable file
·42 lines (33 loc) · 814 Bytes
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
#!/bin/python3
import commands
import utils
current = utils.Note(name="Root")
links = {}
commands.current = current
commands.links = links
def main():
from sys import argv
# TODO support for multiple commands
if len(argv) > 1:
cmd = argv[1:]
func = cmd[0]
args = cmd[1:]
print(f"Executing ", *cmd, "...")
execute(func, args)
print("Wellcome To Tree-Notes, For help, type \"help\"")
while True:
cmd = input(">>>: ").split()
if cmd:
func = cmd[0]
args = cmd[1:]
execute(func, args)
else:
continue
def execute(func, args):
for f in commands.functions:
if f.__name__ == func:
f(*args)
break
else:
print("invalid command")
main()