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 70741b9

Browse files
committed
Clean up and order --help options
1 parent 8141cf0 commit 70741b9

File tree

2 files changed

+41
-28
lines changed

2 files changed

+41
-28
lines changed

‎README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,24 @@ The problem names are automatically extracted from the folder names inside **dat
6464

6565
## Usage
6666
```text
67-
$ python main.py --help
68-
OpenLeetCode problem builder
67+
$ python openleetcode.py --help
68+
usage: openleetcode.py [-h] [--language {cpp}] [--list-problems] [--problem problem_name]
69+
[--problem_builds_dir dir] [--verbose]
70+
71+
OpenLeetCode problem builder. This script builds and tests a leetcode like problems locally. Currently, it only supports C++ language but it can be extended to support other languages.
6972
7073
options:
7174
-h, --help show this help message and exit
72-
--problem_builds_dir dir, -d dir
73-
Path to a directory with the problems. Usually ./problem_builds/ directory
7475
--language {cpp}, -l {cpp}
75-
The programming language
76+
The programming language.
77+
--list-problems List problems.
7678
--problem problem_name, -p problem_name
77-
Name of the problem to build and test. Example: TwoSum
79+
Name of the problem to build and test. Default: TwoSum. Use --list-problems to
80+
list all problems.
81+
--problem_builds_dir dir, -d dir
82+
Path to a directory with the problems. Usually ./problem_builds/ directory.
83+
Default: problem_builds.
7884
--verbose, -v Print verbose output
79-
--list-problems List problems
8085
```
8186

8287
## Note

‎src/app/openleetcode.py

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,39 @@ def run(command):
2929
return True
3030

3131
def main():
32-
parser = argparse.ArgumentParser(description="OpenLeetCode problem builder")
33-
parser.add_argument("--problem_builds_dir", "-d",
34-
default="problem_builds",
35-
metavar='dir',
36-
type=str,
37-
help=("Path to a directory with the problems. "
38-
"Usually ./problem_builds/ directory"))
39-
parser.add_argument("--language", "-l",
40-
choices=['cpp'],
41-
default="cpp",
42-
help="The programming language")
43-
parser.add_argument("--problem", "-p",
44-
metavar='problem_name',
45-
default="TwoSum",
46-
type=str,
47-
help="Name of the problem to build and test. "
48-
"Example: TwoSum, LongestSubstringWithoutRepeatingCharacters")
32+
parser = argparse.ArgumentParser(
33+
description="OpenLeetCode problem builder. This script builds and "
34+
"tests a leetcode like problems locally. Currently, it "
35+
"only supports C++ language but it can be extended to "
36+
"support other languages.")
37+
parser.add_argument(
38+
"--language", "-l",
39+
choices=['cpp'],
40+
default="cpp",
41+
help="The programming language.")
42+
parser.add_argument(
43+
"--list-problems",
44+
action="store_true",
45+
default=False,
46+
help="List problems.")
47+
parser.add_argument(
48+
"--problem", "-p",
49+
metavar='problem_name',
50+
default="TwoSum",
51+
type=str,
52+
help="Name of the problem to build and test. Default: TwoSum. Use "
53+
"--list-problems to list all problems.")
54+
parser.add_argument(
55+
"--problem_builds_dir", "-d",
56+
default="problem_builds",
57+
metavar='dir',
58+
type=str,
59+
help=("Path to a directory with the problems. Usually "
60+
"./problem_builds/ directory. Default: problem_builds."))
4961
parser.add_argument("--verbose", "-v",
5062
action="store_true",
5163
default=False,
5264
help="Print verbose output")
53-
parser.add_argument("--list-problems",
54-
action="store_true",
55-
default=False,
56-
help="List problems")
5765

5866
args = parser.parse_args()
5967

0 commit comments

Comments
(0)

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