Skip to content

Commit

Permalink
Finish up preserve parameter order PR.
Browse files Browse the repository at this point in the history
- Add test to ensure parameter order is preserved.
- Update Authors and Changelog
- Up version to 0.3.1a
  • Loading branch information
navilan committed Feb 20, 2013
1 parent 933aa09 commit ef9d9a1
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 6 deletions.
5 changes: 5 additions & 0 deletions AUTHORS.rst
Expand Up @@ -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
10 changes: 9 additions & 1 deletion CHANGELOG.rst
@@ -1,3 +1,10 @@
Version 0.3.1a
--------------

Thanks to `fruch_ :

- Preserve the order of parameters in declaration.

Version 0.3a
--------------

Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -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
Expand Down
27 changes: 24 additions & 3 deletions commando/tests/test_commando.py
Expand Up @@ -55,7 +55,6 @@ def main(self, params):
def _main(self):
pass


@trap_exit_fail
def test_command_basic():

Expand Down Expand Up @@ -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):

Expand All @@ -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'])
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -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',
Expand Down

0 comments on commit ef9d9a1

Please sign in to comment.