-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate_docs_overview.py
More file actions
56 lines (47 loc) · 1.35 KB
/
create_docs_overview.py
File metadata and controls
56 lines (47 loc) · 1.35 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
from pathlib import Path
from collections import defaultdict
import argparse
def main(out_dir):
out_dir_path = Path(out_dir)
summary = [
'\n',
f'### Overview',
'\n',
]
summaries = defaultdict(list)
paths = list(out_dir_path.iterdir())
paths.sort()
for path in paths:
new_path = Path(str(path).replace('ai::lucidtech::las::sdk::', ''))
link_name = new_path.stem
readme_string = f'* [{link_name}]({str(new_path.name)})'
if link_name.endswith('Client'):
summary.extend([
f'The [Client]({path.name}) class contains all the higher level methods',
'\n',
])
elif 'Options' in link_name:
summaries['options'].append(readme_string)
else:
summaries['other'].append(readme_string)
new_path.write_text(path.read_text())
os.remove(str(path))
summary.extend(
[
f'### Options',
'\n',
] +
summaries['options'] +
[
f'### Other',
'\n',
] +
summaries['other']
)
(out_dir_path / 'README.md').write_text('\n'.join(summary))
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('out_dir')
args = parser.parse_args()
main(**vars(args))