-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert.py
56 lines (36 loc) · 1.24 KB
/
convert.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
from utils import cssHash, htmlHash, loadConfig, loadPath, lookFiles
import os
import sys
def main(args):
"""Main function to run the script.
More details explained on the `functions` docs
"""
# Load config before path for the global variable scope
config = loadConfig()
if args:
_PATH = loadPath(args[0])
else:
_PATH = loadPath()
_PATH = os.path.realpath(_PATH)
search_files = lookFiles(_PATH)
if search_files:
if config["console"]:
# print(f'files: {search_files}\n')
print("CSS Hashfy found files:", end="\n\n")
for root, file in search_files:
print(os.path.join(root, file))
print()
print("Starting hashing...", end="\n\n")
# Initializing algo vars
classes_dict, css_files, css_count = cssHash(search_files)
html_count = htmlHash(search_files, classes_dict, css_files)
if config["console"]:
print()
print(
f"finished! {str(int((html_count + css_count)/len(search_files))*100)}% done."
)
else:
print("!!! No files found!")
################ Main ################
if __name__ == "__main__":
main(sys.argv[1:])