Skip to content

Commit 475fc9f

Browse files
committed
Use named arguments to support future versions
- In particular this help things work with Click 8.x - The hidden argument is now standard so remove it together with special code. See: aboutcode-org/scancode-toolkit#2529 Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent 3aa39a0 commit 475fc9f

1 file changed

Lines changed: 14 additions & 19 deletions

File tree

src/commoncode/cliutils.py

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ def __init__(
352352
allow_from_autoenv=True,
353353
type=None, # NOQA
354354
help=None, # NOQA
355+
hidden=False,
355356
# custom additions #
356357
# a string that set the CLI help group for this option
357358
help_group=MISC_GROUP,
@@ -365,24 +366,22 @@ def __init__(
365366
# a sequence of other option name strings that this option
366367
# conflicts with if they are set
367368
conflicting_options=(),
368-
# a flag set to True if this option should be hidden from the CLI help
369-
hidden=False,
370369
**kwargs
371370
):
372-
373371
super(PluggableCommandLineOption, self).__init__(
374-
param_decls,
375-
show_default,
376-
prompt,
377-
confirmation_prompt,
378-
hide_input,
379-
is_flag,
380-
flag_value,
381-
multiple,
382-
count,
383-
allow_from_autoenv,
384-
type,
385-
help,
372+
param_decls=param_decls,
373+
show_default=show_default,
374+
prompt=prompt,
375+
confirmation_prompt=confirmation_prompt,
376+
hide_input=hide_input,
377+
is_flag=is_flag,
378+
flag_value=flag_value,
379+
multiple=multiple,
380+
count=count,
381+
allow_from_autoenv=allow_from_autoenv,
382+
type=type,
383+
help=help,
384+
hidden=hidden,
386385
**kwargs
387386
)
388387

@@ -413,10 +412,6 @@ def validate_dependencies(self, ctx, value):
413412
_validate_option_dependencies(ctx, self, value, self.required_options, required=True)
414413
_validate_option_dependencies(ctx, self, value, self.conflicting_options, required=False)
415414

416-
def get_help_record(self, ctx):
417-
if not self.hidden:
418-
return click.Option.get_help_record(self, ctx)
419-
420415

421416
def validate_option_dependencies(ctx):
422417
"""

0 commit comments

Comments
 (0)