-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTodo_Cli.py
84 lines (84 loc) · 2.24 KB
/
Todo_Cli.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
loop=int(0)
todo=["----------All TODO----------"]
while loop!=int(4):
cmd=input("/~~/python/CLI/todo/ $ ")
data=cmd.split()
if data[0]=='help':
print("\n\n")
print("\t COMMANDS DESCRIPTION")
print("\t___________________________________\n")
print("\t add arg - Add Todo")
print("\t remove index - Remove Todo")
print("\t done index - Mark Done Todo")
print("\t remain - Remaining Todo")
print("\t complete - Completed Todo")
print("\t ls - Show List")
print("\t help - Information")
print("\t exit - Exit Programm")
print("\n\n")
elif data[0]=='add':
new=""
for each in data:
if each!='add':
new=new+" "+each
if new!="":
todo.append(new)
(f"{new} added")
else:
print("Few Arguments")
elif data[0]=='done':
try:
if int(data[1])>len(todo):
print("Invlid Index")
else:
todo[int(data[1])]=todo[int(data[1])]+" (done)"
except:
print("Too few argument")
elif data[0]=='remain':
for each in todo:
dif=each.split()
try:
dif.index("(done)")
except:
print(each)
elif data[0]=='complete':
for each in todo:
dif=each.split()
try:
if dif.index("(done)"):
print(each)
except:
u=0
elif data[0]=='ls':
cnt=0
for each in todo:
if cnt==0:
print(each)
cnt=cnt+1
else:
print("\t"+str(cnt)+". "+each)
cnt=cnt+1
elif data[0]=='remove':
try:
rem=int(data[1])
todo.remove(todo[rem])
print("Removed")
except:
print("List Error, Probably List Is Empty,or too few arguments")
elif data[0]=='exit':
loop=int(4)
else :
print("Invalid Syntax error")
print(f" {data} not defined")
print("\n\n")
print("\t COMMANDS DESCRIPTION")
print("\t___________________________________\n")
print("\t add arg - Add Todo")
print("\t remove index - Remove Todo")
print("\t done index - Mark Done Todo")
print("\t remain - Remaining Todo")
print("\t complete - Completed Todo")
print("\t ls - Show List")
print("\t help - Information")
print("\t exit - Exit Programm")
print("\n\n")