Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show the ghost positional argument args #154

Merged
merged 3 commits into from
Jul 25, 2020
Merged

Don't show the ghost positional argument args #154

merged 3 commits into from
Jul 25, 2020

Conversation

tekumara
Copy link
Collaborator

@tekumara tekumara commented Jul 25, 2020

Don't show the ghost positional argument args
(fixes #145)

This is fixed by:

wrapper.__signature__ = inspect.signature(func)

But in doing so it forces all @arg decorators to reference arguments in
the function signature. Therefore --profile can't exist because it
doesn't match a function argument. It has been renamed to --config.
Also, because --config is optional on the CLI, the function argument
needs to provide a default even though it's mandatory for the function.
Because python syntax doesn't allow non-default arguments to follow
default arguments it has been moved to be the last argument.

This is fixed by:
```
wrapper.__signature__ = inspect.signature(func)
```
But in doing so it forces all @arg decorators to reference arguments in
the function  signature. Therefore `--profile` can't exist because it
doesn't match a function argument. It has been renamed to `--config`.
Also, because --config is optional on the CLI, the function signature
needs to provide a default even though it's mandatory for the function.
Because python syntax doesn't allow non-default arguments to follow
default arguments it has been moved to be the last argument.
@tekumara tekumara changed the title fix-help Don't show the ghost positional argument args Jul 25, 2020
@tekumara tekumara merged commit 047361f into master Jul 25, 2020
@tekumara tekumara deleted the fix-help branch July 25, 2020 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

positional arguments args
1 participant