Skip to content

Commit

Permalink
Print a summary of broken files in the end
Browse files Browse the repository at this point in the history
  • Loading branch information
amochin committed Sep 8, 2023
1 parent 8722773 commit bb71ee4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion robotframework_libtoc/libtoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def create_toc(html_docs_dir, toc_file="keyword_docs.html", homepage_file="homep
with open(toc_file_path, 'w', encoding="utf8") as f:
f.write(toc(doc_files_links, current_date_time, os.path.relpath(homepage_path, os.path.abspath(html_docs_dir)), toc_template))

print("Finished. Output file: {}".format(os.path.abspath(toc_file_path)))
print("TOC finished. Output file: {}".format(os.path.abspath(toc_file_path)))

def main():
parser = argparse.ArgumentParser(description="Generates keyword docs using libdoc based on config files in direct subfolders of the resources dir and creates a TOC")
Expand All @@ -202,6 +202,8 @@ def main():

print(f"Creating docs for: {os.path.abspath(args.resources_dir)}")

broken_files = []

if os.path.isdir(args.output_dir):
print(f"Output dir already exists, deleting it: {args.output_dir}")
shutil.rmtree(args.output_dir)
Expand All @@ -217,13 +219,20 @@ def main():
create_docs_for_dir(args.resources_dir, args.output_dir, os.path.abspath(os.path.join(args.resources_dir, args.config_file)))
except LibdocException as e:
print(f"---> !!! FAILED generating docs for {e.broken_file}!")
broken_files.append(e.broken_file)
print("Proceed with the next file...")
print("")

if os.path.isdir(args.output_dir):
create_toc(args.output_dir, args.toc_file, toc_template=args.toc_template, homepage_template=args.homepage_template)
else:
print("No docs were created!")

if broken_files:
print("")
print(f"---> !!! FAILED generating docs for {len(broken_files)} files (see details above):")
for f in broken_files:
print(f" - {f}")

if __name__ == "__main__":
main()

0 comments on commit bb71ee4

Please sign in to comment.