mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
cli: Add possibility to hide commands in --help
This commit is contained in:
parent
7e2da7a897
commit
cb9ecb468d
2 changed files with 5 additions and 0 deletions
|
@ -260,11 +260,14 @@ class _ExtendedSubParsersAction(argparse._SubParsersAction):
|
|||
self._deprecated_command_map = {}
|
||||
|
||||
def add_parser(self, name, type_=None, **kwargs):
|
||||
hide_in_help = kwargs.pop("hide_in_help", False)
|
||||
deprecated = kwargs.pop("deprecated", False)
|
||||
deprecated_alias = kwargs.pop("deprecated_alias", [])
|
||||
|
||||
if deprecated:
|
||||
self._deprecated_command_map[name] = None
|
||||
|
||||
if deprecated or hide_in_help:
|
||||
if "help" in kwargs:
|
||||
del kwargs["help"]
|
||||
|
||||
|
|
|
@ -364,6 +364,7 @@ class ActionsMapParser(BaseActionsMapParser):
|
|||
action_help=None,
|
||||
deprecated=False,
|
||||
deprecated_alias=[],
|
||||
hide_in_help=False,
|
||||
**kwargs,
|
||||
):
|
||||
"""Add a parser for an action
|
||||
|
@ -384,6 +385,7 @@ class ActionsMapParser(BaseActionsMapParser):
|
|||
description=action_help,
|
||||
deprecated=deprecated,
|
||||
deprecated_alias=deprecated_alias,
|
||||
hide_in_help=hide_in_help,
|
||||
)
|
||||
|
||||
def add_global_arguments(self, arguments):
|
||||
|
|
Loading…
Reference in a new issue