~epsy/+junk/clize

Viewing all changes in revision 17.

  • Committer: Yann Kaiser
  • Date: 2012-09-29 23:40:30 UTC
  • Revision ID: git-v1:7a1e142f485b07dbc0489c3e8388d0d1b0d28614
Added keyword-only arguments support.

If a keyword-only argument is found, clize will consider all normal arguments positional, and all keyword-only arguments options. Those with defaults are optional while others are required. This indeed makes "required options" possible, and if you do that I hate you. You can force this behaviour by using @clize.kwo instead of @clize. Python 2 compatibility is of course kept, as long as you don't use annotations or keyword-only arguments in your code.

Clize is now also slightly strictier:
* Options that don't take argument will raise an error if given one in the --option=val form.
* Required positional arguments cannot come after optional arguments. It will raise a ValueError now instead of silently making them optional with default value None.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: