()
| 122 | |
| 123 | |
| 124 | def main(): |
| 125 | parser = ArgumentParser(description="Format objdiff-cli report changes.") |
| 126 | parser.add_argument( |
| 127 | "report_changes_file", |
| 128 | type=Path, |
| 129 | help="""path to the JSON file containing the changes, generated by objdiff-cli.""", |
| 130 | ) |
| 131 | parser.add_argument( |
| 132 | "-o", |
| 133 | "--output", |
| 134 | type=Path, |
| 135 | help="""Output file (prints to console if unspecified)""", |
| 136 | ) |
| 137 | parser.add_argument( |
| 138 | "--all", |
| 139 | action="store_true", |
| 140 | help="""Includes progressions as well.""", |
| 141 | ) |
| 142 | args = parser.parse_args() |
| 143 | |
| 144 | regressions, progressions = get_changes(args.report_changes_file) |
| 145 | |
| 146 | if args.output: |
| 147 | markdown_output = generate_changes_markdown(regressions, "regressions") |
| 148 | if args.all: |
| 149 | markdown_output += generate_changes_markdown(progressions, "progressions") |
| 150 | with open(args.output, "w", encoding="utf-8") as f: |
| 151 | f.write(markdown_output) |
| 152 | else: |
| 153 | if args.all: |
| 154 | changes = progressions + regressions |
| 155 | else: |
| 156 | changes = regressions |
| 157 | text_output = generate_changes_plaintext(changes) |
| 158 | print(text_output) |
| 159 | |
| 160 | |
| 161 | if __name__ == "__main__": |
no test coverage detected