|
123 | 123 | "--branch", |
124 | 124 | "-b", |
125 | 125 | default=None, |
126 | | - help=("""The branch or reference name to filter pull requests by"""), |
| 126 | + help=( |
| 127 | + """Filter pull requests by their target branch. Only PRs merged into this branch will be included. """ |
| 128 | + ), |
127 | 129 | ) |
128 | 130 | parser.add_argument( |
129 | 131 | "--all", |
@@ -223,31 +225,36 @@ def main(): |
223 | 225 | ignored_contributors=args.ignore_contributor, |
224 | 226 | ) |
225 | 227 |
|
226 | | - if args.all: |
227 | | - md = generate_all_activity_md(args.target, **common_kwargs) |
| 228 | + # Wrap in a try/except so we don't have an ugly stack trace if there's an error |
| 229 | + try: |
| 230 | + if args.all: |
| 231 | + md = generate_all_activity_md(args.target, **common_kwargs) |
228 | 232 |
|
229 | | - else: |
230 | | - md = generate_activity_md( |
231 | | - args.target, |
232 | | - since=args.since, |
233 | | - until=args.until, |
234 | | - heading_level=args.heading_level, |
235 | | - **common_kwargs, |
236 | | - ) |
| 233 | + else: |
| 234 | + md = generate_activity_md( |
| 235 | + args.target, |
| 236 | + since=args.since, |
| 237 | + until=args.until, |
| 238 | + heading_level=args.heading_level, |
| 239 | + **common_kwargs, |
| 240 | + ) |
237 | 241 |
|
238 | | - if not md: |
239 | | - return |
240 | | - |
241 | | - if args.output: |
242 | | - output = os.path.abspath(args.output) |
243 | | - output_dir = os.path.dirname(output) |
244 | | - if not os.path.exists(output_dir): |
245 | | - os.makedirs(output_dir) |
246 | | - with open(args.output, "w") as ff: |
247 | | - ff.write(md) |
248 | | - print(f"Finished writing markdown to: {args.output}", file=sys.stderr) |
249 | | - else: |
250 | | - print(md) |
| 242 | + if not md: |
| 243 | + return |
| 244 | + |
| 245 | + if args.output: |
| 246 | + output = os.path.abspath(args.output) |
| 247 | + output_dir = os.path.dirname(output) |
| 248 | + if not os.path.exists(output_dir): |
| 249 | + os.makedirs(output_dir) |
| 250 | + with open(args.output, "w") as ff: |
| 251 | + ff.write(md) |
| 252 | + print(f"Finished writing markdown to: {args.output}", file=sys.stderr) |
| 253 | + else: |
| 254 | + print(md) |
| 255 | + except ValueError as e: |
| 256 | + print(f"Error: {e}", file=sys.stderr) |
| 257 | + sys.exit(1) |
251 | 258 |
|
252 | 259 |
|
253 | 260 | if __name__ == "__main__": |
|
0 commit comments