-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgetContents.py
More file actions
42 lines (32 loc) · 1.44 KB
/
getContents.py
File metadata and controls
42 lines (32 loc) · 1.44 KB
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
import os
code_dir = "../Library"
extra_dir = "./extra" # const
div_char = '$'
print(div_char)
print("# First line is the divisor character used to separate the file name from it's title!!!\n# Don't change the first line!!!")
note = f'''
# Any line followed by a '#' character is ignored
# Section headings must be in square brackets
# Subsections within a section should follow the format:
# (filename within code directory)(divisor character:{div_char})(subsection title)
# div character:{div_char}
# If you add an '@' at the end of a file title, that file will not be hashed, even if use_hash is true.
'''
print(note)
for dir in os.listdir(code_dir):
if(os.path.isfile(os.path.join(code_dir, dir))): continue
files = os.listdir(os.path.join(code_dir, dir))
if(len(files) == 0): continue
print(f'[{dir}]')
longestPath = max([len(arquivo) if '.exe' not in arquivo else 0 for arquivo in files])
for arquivo in files:
if('.exe' in arquivo): continue
print(f"{code_dir}/{dir}/{arquivo} {' '*(longestPath-len(arquivo))} {div_char} {arquivo.split('.')[0]}")
print()
print()
print("## Extra content - tex files ##")
print('[Extra]')
for arquivo in os.listdir(extra_dir):
longestName = max([len(arquivo) if '.exe' not in arquivo else 0 for arquivo in files])
if(os.path.isfile(os.path.join(extra_dir, arquivo))):
print(f"{extra_dir}/{arquivo} {' '*(longestPath-len(arquivo))} {div_char}tex")