Skip to content

Commit

Permalink
Add argument groups
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Jan 18, 2021
1 parent 78b96bb commit 52055be
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions piplicenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,26 +622,30 @@ def create_parser():
parser = CompatibleArgumentParser(
description=__summary__)

common_options = parser.add_argument_group('Common options')
format_options = parser.add_argument_group('Format options')
verify_options = parser.add_argument_group('Verify options')

parser.add_argument(
'-v', '--version',
action='version',
version='%(prog)s ' + __version__)

parser.add_argument(
common_options.add_argument(
'--from',
action='store', type=str,
default='mixed', metavar='SOURCE',
help=('where to find license information\n'
'"meta", "classifier, "mixed", "all"\n'
'default: --from=mixed'))
parser.add_argument(
common_options.add_argument(
'-o', '--order',
action='store', type=str,
default='name', metavar='COL',
help=('order by column\n'
'"name", "license", "author", "url"\n'
'default: --order=name'))
parser.add_argument(
common_options.add_argument(
'-f', '--format',
action='store', type=str,
default='plain', metavar='STYLE',
Expand All @@ -650,78 +654,78 @@ def create_parser():
'"confluence", "html", "json", \n'
'"json-license-finder", "csv"\n'
'default: --format=plain'))
parser.add_argument(
common_options.add_argument(
'--summary',
action='store_true',
default=False,
help='dump summary of each license')
parser.add_argument(
common_options.add_argument(
'--output-file',
action='store', type=str,
help='save license list to file')
parser.add_argument(
common_options.add_argument(
'-i', '--ignore-packages',
action='store', type=str,
nargs='+', metavar='PKG',
default=[],
help='ignore package name in dumped list')

parser.add_argument(
format_options.add_argument(
'-s', '--with-system',
action='store_true',
default=False,
help='dump with system packages')
parser.add_argument(
format_options.add_argument(
'-a', '--with-authors',
action='store_true',
default=False,
help='dump with package authors')
parser.add_argument(
format_options.add_argument(
'-u', '--with-urls',
action='store_true',
default=False,
help='dump with package urls')
parser.add_argument(
format_options.add_argument(
'-d', '--with-description',
action='store_true',
default=False,
help='dump with short package description')
parser.add_argument(
format_options.add_argument(
'-l', '--with-license-file',
action='store_true',
default=False,
help='dump with location of license file and '
'contents, most useful with JSON output')
parser.add_argument(
format_options.add_argument(
'--no-license-path',
action='store_true',
default=False,
help='when specified together with option -l, '
'suppress location of license file output')
parser.add_argument(
format_options.add_argument(
'--with-notice-file',
action='store_true',
default=False,
help='when specified together with option -l, '
'dump with location of license file and contents')
parser.add_argument(
format_options.add_argument(
'--filter-strings',
action="store_true",
default=False,
help=('filter input according to code page'))
parser.add_argument(
format_options.add_argument(
'--filter-code-page',
action="store", type=str,
default="latin1",
help=('specify code page for filtering'))

parser.add_argument(
verify_options.add_argument(
'--fail-on',
action='store', type=str,
default=None,
help='fail (exit with code 1) on the first occurrence '
'of the licenses of the semicolon-separated list')
parser.add_argument(
verify_options.add_argument(
'--allow-only',
action='store', type=str,
default=None,
Expand Down

0 comments on commit 52055be

Please sign in to comment.