-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWordOcc.py
40 lines (38 loc) · 1.09 KB
/
WordOcc.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
#!/usr/bin/python 3
# -*- coding: utf-8 -*-
''' Main script '''
import sys
from fileutils import FileMenu
from WordToolBox import TextToolBox
# Multiline comments in source files are 'counted as code' in programmer mode
def main():
onset=True
if len(sys.argv)>1:
if sys.argv[1] == "--help" or sys.argv[1] == "/?":
omode = "help"
onset = False
elif sys.argv[1] == "--prog" or sys.argv[1] == "/p":
omode = "programmer"
elif sys.argv[1] == "--refs" or sys.argv[1] == "/r":
print("not ready yet") #open issue
onset = False #open issue
omode = "refsigns"
elif sys.argv[1] == "--search" or sys.argv[1] == "/s":
omode = "search"
else:
print(f"Unknown argument {sys.argv[1]}.")
onset = False
omode = "help"
else:
#default option used without any command-line argument
omode = "textual"
if onset:
dafr = FileMenu()
if dafr.FileManager():
ttb = TextToolBox(dafr.GetInputFilesList(), dafr.GetOutputFile())
ttb.WordStatistics(omode)
else:
ttb = TextToolBox("", "")
ttb.WordStatistics(omode)
if __name__=="__main__":
main();