Skip to content

Commit 5b4d553

Browse files
authored
Merge pull request #102 from fosslight/develop
Fix not to print argparse's help msg
2 parents 4b97137 + 1e47e74 commit 5b4d553

File tree

1 file changed

+3
-3
lines changed
  • src/fosslight_prechecker

1 file changed

+3
-3
lines changed

src/fosslight_prechecker/cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
def main():
1616
parser = argparse.ArgumentParser(description='FOSSLight Prechecker', prog='fosslight_prechecker', add_help=False)
17-
parser.add_argument('mode', nargs='?', help='lint | convert | add', default="")
17+
parser.add_argument('mode', nargs='?', help='lint | convert | add', choices=['lint', 'convert', 'add'])
1818
parser.add_argument('--path', '-p', help='Path to check', type=str, dest='path', default="")
1919
parser.add_argument('--format', '-f', help='Format of ouput', type=str, dest='format', default="")
2020
parser.add_argument('--output', '-o', help='Output file name', type=str, dest='output', default="")
@@ -25,11 +25,11 @@ def main():
2525
parser.add_argument('--ignore', '-i', help='Do not write log to file', action='store_false', dest='log')
2626
parser.add_argument('--version', '-v', help='Print FOSSLight Prechecker version', action='store_true', dest='version')
2727
try:
28-
args = parser.parse_args()
28+
args, unknown = parser.parse_known_args()
2929
except SystemExit:
3030
print_help_msg()
3131

32-
if args.help:
32+
if args.help or unknown:
3333
print_help_msg()
3434

3535
if args.version:

0 commit comments

Comments
 (0)