Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Finish up preserve parameter order PR.

- Add test to ensure parameter order is preserved.
- Update Authors and Changelog
- Up version to 0.3.1a
  • Loading branch information...
commit ef9d9a1e9110d7c317db9e7e689f18e62a0c3915 1 parent 933aa09
@lakshmivyas authored
View
5 AUTHORS.rst
@@ -24,7 +24,12 @@ Authors
- Support for nested subcommands. (Pull #7)
+* `fruch`_
+
+ Use the parameters in the same order as provided. (Pulls #8)
+
.. _Lakshmi Vyas: https://github.com/lakshmivyas
.. _Brandon Philips: https://github.com/philips
.. _Ben West: https://github.com/bewest
.. _Julien Danjou: https://github.com/jd
+.. _fruch: https://github.com/fruch
View
10 CHANGELOG.rst
@@ -1,3 +1,10 @@
+Version 0.3.1a
+--------------
+
+Thanks to `fruch_ :
+
+- Preserve the order of parameters in declaration.
+
Version 0.3a
--------------
@@ -50,4 +57,5 @@ Version 0.1a
.. _Lakshmi Vyas: https://github.com/lakshmivyas
.. _Brandon Philips: https://github.com/philips
.. _Ben West: https://github.com/bewest
-.. _Julien Danjou: https://github.com/jd
+.. _Julien Danjou: https://github.com/jd
+.. _fruch: https://github.com/fruch
View
2  README.rst
@@ -2,7 +2,7 @@
commando - argparse in style
============================
-**Version 0.3a**
+**Version 0.3.1a**
A simple wrapper for ``argparse`` that allows commands and arguments
to be defined declaratively using decorators. Note that this does
View
27 commando/tests/test_commando.py
@@ -55,7 +55,6 @@ def main(self, params):
def _main(self):
pass
-
@trap_exit_fail
def test_command_basic():
@@ -84,6 +83,28 @@ def test_command_version_param():
assert not _main.called
+def test_positional_params():
+ class PositionalCommandLine(Application):
+
+ @command(description='test', prog='Basic')
+ @param('force1', action='store')
+ @param('force3', action='store')
+ @param('force2', action='store')
+ def main(self, params):
+ self._main(params)
+
+ def _main(self, params):
+ assert params.force1 == '1'
+ assert params.force3 == '2'
+ assert params.force2 == '3'
+
+
+
+ p = PositionalCommandLine()
+ args = p.parse(['1', '2', '3'])
+ p.run(args)
+
+
def test_command_version():
class VersionCommandLine(Application):
@@ -98,8 +119,8 @@ def main(self, params):
def _main(self):
pass
- with patch.object(BasicCommandLine, '_main') as _main:
- c = BasicCommandLine()
+ with patch.object(VersionCommandLine, '_main') as _main:
+ c = VersionCommandLine()
exception = False
try:
c.parse(['--version'])
View
2  setup.py
@@ -13,7 +13,7 @@
description='A declarative interface to argparse with additional utilities',
long_description=long_description,
- version='0.3a',
+ version='0.3.1a',
author='Lakshmi Vyas',
author_email='lakshmi.vyas@gmail.com',
Please sign in to comment.
Something went wrong with that request. Please try again.