Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion aws_doc_sdk_examples_tools/doc_gen_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import logging

from .doc_gen import DocGen, DocGenEncoder
from .entities import EntityErrors

logging.basicConfig(level=logging.INFO)

Expand All @@ -28,6 +27,12 @@ def main():
type=str,
help="Output a JSON version of the computed DocGen with some properties stripped out. Includes any errors.",
)
parser.add_argument(
"--write-snippets",
default="doc_gen_snippets.json",
type=str,
help="Output a JSON version of the computed DocGen with only snippets and snippet files. Separates snippet content from metadata content.",
)

parser.add_argument(
"--strict",
Expand Down Expand Up @@ -61,6 +66,19 @@ def main():
with open(args.write_json, "w") as out:
out.write(serialized)

for root in args.from_root:
merged_doc_gen.collect_snippets(Path(root))

serialized_snippets = json.dumps(
{
"snippets": merged_doc_gen.snippets,
"snippet_files": merged_doc_gen.snippet_files,
},
cls=DocGenEncoder,
)
with open(args.write_snippets, "w") as out:
out.write(serialized_snippets)


if __name__ == "__main__":
main()
Loading