Skip to content

Commit a218b40

Browse files
authored
fix: docs for default of CLI switch --mc-type (#710)
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
1 parent db0db69 commit a218b40

File tree

6 files changed

+43
-26
lines changed

6 files changed

+43
-26
lines changed

cyclonedx_py/_internal/cli.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ def make_argument_parser(cls, sco: ArgumentParser, **kwargs: Any) -> ArgumentPar
7373
default=False)
7474
op.add_argument('-o', '--outfile',
7575
metavar='<file>',
76-
help='Output file path for your SBOM (set to "-" to output to <stdout>) (default: %(default)s)',
76+
help='Output file path for your SBOM'
77+
' (set to "-" to output to <stdout>)'
78+
' (default: %(default)s)',
7779
type=FileType('wt', encoding='utf8'),
7880
dest='outfile',
7981
default='-')
@@ -88,7 +90,9 @@ def make_argument_parser(cls, sco: ArgumentParser, **kwargs: Any) -> ArgumentPar
8890
default=SchemaVersion.V1_5.to_version())
8991
op.add_argument('--of', '--output-format',
9092
metavar='<format>',
91-
help=f'The output format for your SBOM {choices4enum(OutputFormat)} (default: %(default)s)',
93+
help='The output format for your SBOM'
94+
f' {choices4enum(OutputFormat)}'
95+
' (default: %(default)s)',
9296
dest='output_format',
9397
choices=OutputFormat,
9498
type=argparse_type4enum(OutputFormat),
@@ -101,14 +105,16 @@ def make_argument_parser(cls, sco: ArgumentParser, **kwargs: Any) -> ArgumentPar
101105
default=False)
102106
if BooleanOptionalAction:
103107
op.add_argument('--validate',
104-
help='Whether validate the result before outputting (default: %(default)s)',
108+
help='Whether validate the result before outputting'
109+
' (default: %(default)s)',
105110
action=BooleanOptionalAction,
106111
dest='should_validate',
107112
default=True)
108113
else:
109114
vg = op.add_mutually_exclusive_group()
110115
vg.add_argument('--validate',
111-
help='Validate the result before outputting (default: %(default)s)',
116+
help='Validate the result before outputting'
117+
' (default: %(default)s)',
112118
action='store_true',
113119
dest='should_validate',
114120
default=True)
@@ -253,7 +259,9 @@ def __call__(self,
253259
def run(*, argv: Optional[List[str]] = None, **kwargs: Any) -> int:
254260
arg_co = ArgumentParser(add_help=False)
255261
arg_co.add_argument('-v', '--verbose',
256-
help='Increase the verbosity of messages (multiple for more effect) (default: silent)',
262+
help='Increase the verbosity of messages'
263+
' (multiple for more effect)'
264+
' (default: silent)',
257265
dest='verbosity',
258266
action='count',
259267
default=0)

cyclonedx_py/_internal/cli_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ def add_argument_mc_type(p: 'ArgumentParser') -> 'Action':
4848
dest='mc_type',
4949
choices=choices,
5050
type=argparse_type4enum(ComponentType),
51-
default=ComponentType.APPLICATION)
51+
default=ComponentType.APPLICATION.value)

cyclonedx_py/_internal/pipenv.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,23 @@ def make_argument_parser(**kwargs: Any) -> 'ArgumentParser':
6464
type=arparse_split(' ', ','),
6565
default=[])
6666
p.add_argument('-d', '--dev',
67-
help='Analyse both develop and default packages [env var: PIPENV_DEV]',
67+
help='Analyse both develop and default packages'
68+
' [env var: PIPENV_DEV]',
6869
action='store_true',
6970
dest='dev',
7071
default=getenv('PIPENV_DEV', '').lower() in ('1', 'true', 'yes', 'on'))
7172
p.add_argument('--pypi-mirror',
7273
metavar='<url>',
73-
help='Specify a PyPI mirror [env var: PIPENV_PYPI_MIRROR]',
74+
help='Specify a PyPI mirror'
75+
' [env var: PIPENV_PYPI_MIRROR]',
7476
dest='pypi_url',
7577
default=getenv('PIPENV_PYPI_MIRROR'))
7678
add_argument_pyproject(p)
7779
add_argument_mc_type(p)
7880
p.add_argument('project_directory',
7981
metavar='<project-directory>',
80-
help='The project directory for Pipenv (default: current working directory)\n'
82+
help='The project directory for Pipenv'
83+
' (default: current working directory)\n'
8184
'Unlike Pipenv tool, there is no search-up in this very tool. ' # yet
8285
'Please provide the actual directory that contains `Pipfile` and `Pipfile.lock` file.',
8386
nargs=OPTIONAL,

cyclonedx_py/_internal/poetry.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,23 @@ def make_argument_parser(**kwargs: Any) -> 'ArgumentParser':
107107
# the options and switches SHALL mimic the ones from Poetry, which uses comma-separated lists and multi-use
108108
p.add_argument('--without',
109109
metavar='<groups>',
110-
help='The dependency groups to ignore (multiple values allowed)',
110+
help='The dependency groups to ignore'
111+
' (multiple values allowed)',
111112
action='append',
112113
dest='groups_without',
113114
default=[])
114115
p.add_argument('--with',
115116
metavar='<groups>',
116-
help='The optional dependency groups to include (multiple values allowed)',
117+
help='The optional dependency groups to include'
118+
' (multiple values allowed)',
117119
action='append',
118120
dest='groups_with',
119121
default=[])
120122
og = p.add_mutually_exclusive_group()
121123
og.add_argument('--only',
122124
metavar='<groups>',
123-
help='The only dependency groups to include (multiple values allowed)',
125+
help='The only dependency groups to include'
126+
' (multiple values allowed)',
124127
action='append',
125128
dest='groups_only',
126129
default=[])
@@ -132,20 +135,23 @@ def make_argument_parser(**kwargs: Any) -> 'ArgumentParser':
132135
eg = p.add_mutually_exclusive_group()
133136
eg.add_argument('-E', '--extras',
134137
metavar='<extras>',
135-
help='Extra sets of dependencies to include (multiple values allowed)',
138+
help='Extra sets of dependencies to include'
139+
' (multiple values allowed)',
136140
action='append',
137141
dest='extras',
138142
default=[])
139143
eg.add_argument('--all-extras',
140-
help='Include all extra dependencies (default: %(default)s)',
144+
help='Include all extra dependencies'
145+
' (default: %(default)s)',
141146
action='store_true',
142147
dest='all_extras',
143148
default=False)
144149
del eg
145150
add_argument_mc_type(p)
146151
p.add_argument('project_directory',
147152
metavar='<project-directory>',
148-
help='The project directory for Poetry (default: current working directory)',
153+
help='The project directory for Poetry'
154+
' (default: current working directory)',
149155
nargs=OPTIONAL,
150156
default='.')
151157
return p

cyclonedx_py/_internal/requirements.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,23 +76,23 @@ def make_argument_parser(**kwargs: Any) -> 'ArgumentParser':
7676
metavar='<url>',
7777
help='Base URL of the Python Package Index. '
7878
'This should point to a repository compliant with PEP 503 (the simple repository API) '
79-
'or a local directory laid out in the same format. '
80-
'(default: %(default)s)',
79+
'or a local directory laid out in the same format.'
80+
' (default: %(default)s)',
8181
dest='index_url',
8282
default='https://pypi.org/simple')
8383
p.add_argument('--extra-index-url',
8484
metavar='<url>',
85-
help='Extra URLs of package indexes to use in addition to --index-url.'
86-
' Should follow the same rules as --index-url',
85+
help='Extra URLs of package indexes to use in addition to --index-url. '
86+
'Should follow the same rules as --index-url',
8787
action='append',
8888
dest='extra_index_urls',
8989
default=[])
9090
add_argument_pyproject(p)
9191
add_argument_mc_type(p)
9292
p.add_argument('requirements_file',
9393
metavar='<requirements-file>',
94-
help='Path to requirements file. May be set to "-" to read from <stdin>. '
95-
'(default: %(default)r in current working directory)',
94+
help='Path to requirements file. May be set to "-" to read from <stdin>.'
95+
' (default: %(default)r in current working directory)',
9696
nargs=OPTIONAL,
9797
default='requirements.txt')
9898
return p

docs/usage.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The full documentation can be issued by running with ``environment --help``:
6969
This should point to a file compliant with PEP 621 (storing project metadata).
7070
--mc-type <type> Type of the main component
7171
{choices: application, firmware, library}
72-
(default: ComponentType.APPLICATION)
72+
(default: application)
7373
--short-PURLs Omit all qualifiers from PackageURLs.
7474
This causes information loss in trade-off shorter PURLs, which might improve ingesting these strings.
7575
-o <file>, --outfile <file>
@@ -229,7 +229,7 @@ The full documentation can be issued by running with ``pipenv --help``:
229229
This should point to a file compliant with PEP 621 (storing project metadata).
230230
--mc-type <type> Type of the main component
231231
{choices: application, firmware, library}
232-
(default: ComponentType.APPLICATION)
232+
(default: application)
233233
--short-PURLs Omit all qualifiers from PackageURLs.
234234
This causes information loss in trade-off shorter PURLs, which might improve ingesting these strings.
235235
-o <file>, --outfile <file>
@@ -302,9 +302,9 @@ The full documentation can be issued by running with ``poetry --help``:
302302
(multiple values allowed)
303303
--all-extras Include all extra dependencies
304304
(default: False)
305-
--mc-type <type> Type of the main component
305+
--mc-type <type> Type of the main component
306306
{choices: application, firmware, library}
307-
(default: ComponentType.APPLICATION)
307+
(default: application)
308308
--short-PURLs Omit all qualifiers from PackageURLs.
309309
This causes information loss in trade-off shorter PURLs, which might improve ingesting these strings.
310310
-o <file>, --outfile <file>
@@ -374,7 +374,7 @@ The full documentation can be issued by running with ``requirements --help``:
374374
This should point to a file compliant with PEP 621 (storing project metadata).
375375
--mc-type <type> Type of the main component
376376
{choices: application, firmware, library}
377-
(default: ComponentType.APPLICATION)
377+
(default: application)
378378
--short-PURLs Omit all qualifiers from PackageURLs.
379379
This causes information loss in trade-off shorter PURLs, which might improve ingesting these strings.
380380
-o <file>, --outfile <file>

0 commit comments

Comments
 (0)