|
3 | 3 | # Copyright (c) 2021 LG Electronics Inc. |
4 | 4 | # SPDX-License-Identifier: GPL-3.0-only |
5 | 5 | import argparse |
6 | | -from ._help import _HELP_MESSAGE_REUSE |
| 6 | +from ._help import print_help_msg |
7 | 7 | from ._fosslight_reuse import run_lint |
8 | 8 | from fosslight_oss_pkg.fosslight_oss_pkg import convert_report |
9 | 9 | from ._add import add_content |
10 | 10 |
|
11 | 11 |
|
12 | 12 | def main(): |
13 | | - parser = argparse.ArgumentParser(description='FOSSLight Reuse', usage=_HELP_MESSAGE_REUSE) |
| 13 | + parser = argparse.ArgumentParser(description='FOSSLight Reuse', prog='fosslight_reuse', add_help=False) |
14 | 14 | parser.add_argument('mode', help='lint | report | add') |
15 | 15 | parser.add_argument('--path', '-p', help='Path to check', type=str, dest='path', default="") |
16 | 16 | parser.add_argument('--file', '-f', help='Files to check', type=str, dest='file', default="") |
17 | 17 | parser.add_argument('--output', '-o', help='Output file name', type=str, dest='output', default="") |
18 | 18 | parser.add_argument('--no', '-n', help='Disable automatic exclude mode', action='store_true', dest='disable') |
19 | 19 | parser.add_argument('--license', '-l', help='License name to add', type=str, dest='license', default="") |
20 | 20 | parser.add_argument('--copyright', '-c', help='Copyright to add', type=str, dest='copyright', default="") |
21 | | - args = parser.parse_args() |
| 21 | + parser.add_argument('--help', '-h', help='Print help message', action='store_true', dest='help') |
| 22 | + try: |
| 23 | + args = parser.parse_args() |
| 24 | + except SystemExit: |
| 25 | + print_help_msg() |
| 26 | + |
| 27 | + if args.help: |
| 28 | + print_help_msg() |
22 | 29 |
|
23 | 30 | if args.mode == "lint": |
24 | 31 | run_lint(args.path, args.file, args.disable, args.output) |
|
0 commit comments