[ref] Rename 'deprecated' action argument to 'deprecated_alias'

This commit is contained in:
Jérôme Lebleu 2016-04-16 21:02:10 +02:00
parent f70a2ca3e1
commit 802c39f117
3 changed files with 15 additions and 11 deletions

10
debian/control vendored
View file

@ -2,7 +2,7 @@ Source: moulinette
Section: python
Priority: optional
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
X-Python-Version: >= 2.7
Homepage: https://github.com/YunoHost/moulinette
@ -19,5 +19,9 @@ Depends: ${misc:Depends}, ${python:Depends},
Replaces: yunohost-cli
Breaks: yunohost-cli
Description: prototype interfaces with ease in Python
The moulinette is a Python package that allows to quickly and
easily prototype interfaces for your application.
The moulinette is a Python package that allows one to quickly and
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.

View file

@ -446,7 +446,7 @@ class _ExtendedSubParsersAction(argparse._SubParsersAction):
It also provides the following additional properties for parsers,
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):
@ -457,12 +457,12 @@ class _ExtendedSubParsersAction(argparse._SubParsersAction):
self._deprecated_command_map = {}
def add_parser(self, name, **kwargs):
deprecated = kwargs.pop('deprecated', [])
deprecated_alias = kwargs.pop('deprecated_alias', [])
parser = super(_ExtendedSubParsersAction, self).add_parser(
name, **kwargs)
# Append each deprecated command name
for command in deprecated:
# Append each deprecated command alias name
for command in deprecated_alias:
self._deprecated_command_map[command] = name
self._name_parser_map[command] = parser

View file

@ -269,20 +269,20 @@ class ActionsMapParser(BaseActionsMapParser):
'title': "actions", 'required': True
})
def add_action_parser(self, name, tid, action_help=None, deprecated=[],
**kwargs):
def add_action_parser(self, name, tid, action_help=None,
deprecated_alias=[], **kwargs):
"""Add a parser for an action
Keyword arguments:
- 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:
A new ExtendedArgumentParser object for the action
"""
return self._subparsers.add_parser(name, help=action_help,
deprecated=deprecated)
deprecated_alias=deprecated_alias)
def parse_args(self, args, **kwargs):
try: