-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathnii.py
48 lines (40 loc) · 1.06 KB
/
nii.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
import os
import sys
import enc
import dec
args = sys.argv
rds = ['-e', '-d']
def layout_help():
help_content = '''
Novel_In_Image v0.2
Usage: python {} [[-e|-d filename]|-h|-i]
-e : Encode the file
-d : Decode the file
-h : View this help page
-i : Install the dependencies
'''.format(sys.argv[0])
print(help_content)
return
def install_dependencies():
os.system('pip install pillow')
os.system('pip3 install pillow')
return
def raise_err():
help_content = '''
Unknown argument: "{}"
Type "python {} -h" to see the usage.
'''.format(sys.argv[1], sys.argv[0])
print(help_content)
return
if __name__ == '__main__':
if len(args) == 1 or (len(args) == 2 and args[1] == '-h'):
layout_help()
elif len(args) == 2 and args[1] == '-i':
install_dependencies()
elif len(args) == 3 and args[1] in rds:
if args[1] == rds[0]:
enc.main(args[2])
else:
dec.main(args[2])
else:
raise_err()