Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8141cf0

Browse files
committed
Add --list-problems option
1 parent 0a07736 commit 8141cf0

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ options:
7676
--problem problem_name, -p problem_name
7777
Name of the problem to build and test. Example: TwoSum
7878
--verbose, -v Print verbose output
79+
--list-problems List problems
7980
```
8081

8182
## Note

‎src/app/openleetcode.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
import functionextractor
1212

1313
# TODO:
14-
# Rename main.py to openleetcode.py
1514
# add option to run a single testcase
16-
# List the problems in --help
1715
# clean up logs
1816
# test on cmd, PowerShell, Winddows Terminal
1917

@@ -52,11 +50,22 @@ def main():
5250
action="store_true",
5351
default=False,
5452
help="Print verbose output")
53+
parser.add_argument("--list-problems",
54+
action="store_true",
55+
default=False,
56+
help="List problems")
5557

5658
args = parser.parse_args()
5759

5860
logger.set_verbose(args.verbose)
5961

62+
if (args.list_problems):
63+
print("List of problems:")
64+
problems_dir = os.path.join(args.problem_builds_dir, "problems")
65+
for problem in os.listdir(problems_dir):
66+
print(problem)
67+
sys.exit(0)
68+
6069
print("Running OpenLeetCode on problem: " + args.problem)
6170

6271
if not os.path.isdir(args.problem_builds_dir):

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /