-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
41 lines (36 loc) · 887 Bytes
/
run.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
'''
Created by Aleksandar Damnjanovic
Date: 13.11.2021
'''
import alphaSwap as asw
import sys
import string
args= sys.argv
p= args[1]
a=""
if(len(args)>2):
a= args[2]
obj= asw.alphaSwap()
if p!='-raw':
if a=="":
try:
if str.endswith(p,".pdf"):
obj.swapPdfFile(p)
elif str.endswith(p, ".docx"):
obj.swapDocxFile(p)
elif str.endswith(p, ".txt"):
obj.swapTextFile(p)
except:
print("Problem loading the path. Please, check your arguments")
elif a=='-dir':
try:
obj.processDirectory(p)
except:
print("Problem loading the path. Please, check your arguments")
else:
try:
text=args[2]
response= obj.swapRawText(text)
print(response)
except:
print("Error! Please, check your arguments")