mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
[ref] Rename 'deprecated' action argument to 'deprecated_alias'
This commit is contained in:
parent
f70a2ca3e1
commit
802c39f117
3 changed files with 15 additions and 11 deletions
10
debian/control
vendored
10
debian/control
vendored
|
@ -2,7 +2,7 @@ Source: moulinette
|
||||||
Section: python
|
Section: python
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: Jérôme Lebleu <jerome.lebleu@mailoo.org>
|
Maintainer: Jérôme Lebleu <jerome.lebleu@mailoo.org>
|
||||||
Build-Depends: debhelper (>= 9), python (>= 2.7)
|
Build-Depends: debhelper (>= 9), python (>= 2.7), dh-python
|
||||||
Standards-Version: 3.9.6
|
Standards-Version: 3.9.6
|
||||||
X-Python-Version: >= 2.7
|
X-Python-Version: >= 2.7
|
||||||
Homepage: https://github.com/YunoHost/moulinette
|
Homepage: https://github.com/YunoHost/moulinette
|
||||||
|
@ -19,5 +19,9 @@ Depends: ${misc:Depends}, ${python:Depends},
|
||||||
Replaces: yunohost-cli
|
Replaces: yunohost-cli
|
||||||
Breaks: yunohost-cli
|
Breaks: yunohost-cli
|
||||||
Description: prototype interfaces with ease in Python
|
Description: prototype interfaces with ease in Python
|
||||||
The moulinette is a Python package that allows to quickly and
|
The moulinette is a Python package that allows one to quickly and
|
||||||
easily prototype interfaces for your application.
|
easily prototype interfaces for your application. Each action can
|
||||||
|
be served through an HTTP API and from the command-line with a single
|
||||||
|
method.
|
||||||
|
.
|
||||||
|
It was originally written for the YunoHost project.
|
||||||
|
|
|
@ -446,7 +446,7 @@ class _ExtendedSubParsersAction(argparse._SubParsersAction):
|
||||||
|
|
||||||
It also provides the following additional properties for parsers,
|
It also provides the following additional properties for parsers,
|
||||||
e.g. using `subparsers.add_parser`:
|
e.g. using `subparsers.add_parser`:
|
||||||
- deprecated -- A list of deprecated command names
|
- deprecated_alias -- A list of deprecated command alias names
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
@ -457,12 +457,12 @@ class _ExtendedSubParsersAction(argparse._SubParsersAction):
|
||||||
self._deprecated_command_map = {}
|
self._deprecated_command_map = {}
|
||||||
|
|
||||||
def add_parser(self, name, **kwargs):
|
def add_parser(self, name, **kwargs):
|
||||||
deprecated = kwargs.pop('deprecated', [])
|
deprecated_alias = kwargs.pop('deprecated_alias', [])
|
||||||
parser = super(_ExtendedSubParsersAction, self).add_parser(
|
parser = super(_ExtendedSubParsersAction, self).add_parser(
|
||||||
name, **kwargs)
|
name, **kwargs)
|
||||||
|
|
||||||
# Append each deprecated command name
|
# Append each deprecated command alias name
|
||||||
for command in deprecated:
|
for command in deprecated_alias:
|
||||||
self._deprecated_command_map[command] = name
|
self._deprecated_command_map[command] = name
|
||||||
self._name_parser_map[command] = parser
|
self._name_parser_map[command] = parser
|
||||||
|
|
||||||
|
|
|
@ -269,20 +269,20 @@ class ActionsMapParser(BaseActionsMapParser):
|
||||||
'title': "actions", 'required': True
|
'title': "actions", 'required': True
|
||||||
})
|
})
|
||||||
|
|
||||||
def add_action_parser(self, name, tid, action_help=None, deprecated=[],
|
def add_action_parser(self, name, tid, action_help=None,
|
||||||
**kwargs):
|
deprecated_alias=[], **kwargs):
|
||||||
"""Add a parser for an action
|
"""Add a parser for an action
|
||||||
|
|
||||||
Keyword arguments:
|
Keyword arguments:
|
||||||
- action_help -- A brief description for the action
|
- action_help -- A brief description for the action
|
||||||
- deprecated -- A list of deprecated action names
|
- deprecated_alias -- A list of deprecated action alias names
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A new ExtendedArgumentParser object for the action
|
A new ExtendedArgumentParser object for the action
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self._subparsers.add_parser(name, help=action_help,
|
return self._subparsers.add_parser(name, help=action_help,
|
||||||
deprecated=deprecated)
|
deprecated_alias=deprecated_alias)
|
||||||
|
|
||||||
def parse_args(self, args, **kwargs):
|
def parse_args(self, args, **kwargs):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Reference in a new issue