File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
aws_doc_sdk_examples_tools Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 77import logging
88
99from .doc_gen import DocGen , DocGenEncoder
10- from .entities import EntityErrors
1110
1211logging .basicConfig (level = logging .INFO )
1312
@@ -28,6 +27,12 @@ def main():
2827 type = str ,
2928 help = "Output a JSON version of the computed DocGen with some properties stripped out. Includes any errors." ,
3029 )
30+ parser .add_argument (
31+ "--write-snippets" ,
32+ default = "doc_gen_snippets.json" ,
33+ type = str ,
34+ help = "Output a JSON version of the computed DocGen with only snippets and snippet files. Separates snippet content from metadata content." ,
35+ )
3136
3237 parser .add_argument (
3338 "--strict" ,
@@ -61,6 +66,19 @@ def main():
6166 with open (args .write_json , "w" ) as out :
6267 out .write (serialized )
6368
69+ for root in args .from_root :
70+ merged_doc_gen .collect_snippets (Path (root ))
71+
72+ serialized_snippets = json .dumps (
73+ {
74+ "snippets" : merged_doc_gen .snippets ,
75+ "snippet_files" : merged_doc_gen .snippet_files ,
76+ },
77+ cls = DocGenEncoder ,
78+ )
79+ with open (args .write_snippets , "w" ) as out :
80+ out .write (serialized_snippets )
81+
6482
6583if __name__ == "__main__" :
6684 main ()
You can’t perform that action at this time.
0 commit comments