Skip to content

Commit c4558cb

Browse files
NeverMendelthexe23
andcommitted
Add --only-accepted flag to only save accepted submissions
Co-authored-by: Sun Haochen <sunhaochen@sutu.tech>
1 parent 63ef23d commit c4558cb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

leetcode_export/__main__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def parse_args():
2121
parser.add_argument('--submission-filename', type=str,
2222
default='${date_formatted} - ${status_display} - runtime ${runtime} - memory ${memory}.${extension}',
2323
help='submission filename format')
24+
parser.add_argument('--only-accepted', dest='only_accepted', action='store_true', help='save accepted submissions only')
2425
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', help='enable verbose logging details')
2526
parser.add_argument('-vv', '--extra-verbose', dest='extra_verbose', action='store_true',
2627
help='enable more verbose logging details')
@@ -50,6 +51,8 @@ def main():
5051
]
5152
)
5253

54+
logging.info(args)
55+
5356
problem_template = Template(args.problem_filename)
5457
problem_content_template = Template(args.problem_content)
5558
submission_template = Template(args.submission_filename)
@@ -73,6 +76,9 @@ def main():
7376
written_problems: Set[str] = set()
7477

7578
for submission in leetcode.get_submissions():
79+
if args.only_accepted and submission.status_display != 'Accepted':
80+
continue
81+
7682
if not os.path.exists(submission.title_slug):
7783
os.mkdir(submission.title_slug)
7884
os.chdir(submission.title_slug)

0 commit comments

Comments
 (0)