Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

'invalid arguments' error when using `globaloptions` #51

Open
baldwint opened this Issue · 5 comments

2 participants

@baldwint

I'm seeing a strange behavior when using globaloptions - specifying this keyword argument to dispatch seems to override the arguments introspected from the function.

This should reproduce it: https://gist.github.com/3672842

@piranha
Owner

Hm, interesting, thanks for report. I'll try to fix this ASAP.

@piranha
Owner

Hm, I can't reproduce it. Which version of opster do you use?

@piranha
Owner

Oh well, I'm sorry, I actually can. I'll consider that's a bug since I should improve error messaging somehow, but in short - add parameters to your commands so that they can receive those globaloptions. Even **kwargs will be enough.

@baldwint

Oh, I see.

Adding **kwargs to the argument list of every function is probably the only suitable way to fix this, actually. Manually adding parameters for each individual global option (e.g. username=None, password=None) will lead to an incorrect usage string. You'll get bug.py read PAGE [USERNAME] [PASSWORD], even though these can't be passed as positional arguments.

@piranha
Owner

Well, you can always pass your own usage string in @command(usage="PAGE").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.