Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously,
If a task did NOT have positional arg, passing '--help' to a task iso passing it to invoke directly worked as expected: --help would print the per-task help:
However, when passing '--help' to a task with (mandatory) positional arg, the string would just be passed to the task and executed.
This is not the expected behaviour of '--help', we would expect the per-task help to be printed.
With these commits,
we attempt to fix this issue by detecting when '--help/-h' is passed to a task and stop the parsing to print the per-task help.
Additionally, when a task is called without mandatory arg, the per-task help is now also printed.
As highlighted in #205, this will break any user-task having the --help OR -h cli options:
As stated in previous discussions, users would rather expect --help to produce a help text
than their task be called.
This one is sadly a regression which will impact existing user scripts.
However, IMO, this feels like a small price to pay for more unix-like tool behaviour of invoke.
As an example of what this PR behaves like, f.e. with this tasks.py:
Previous behaviour
New behaviour
Feel free to propose different solutions, disagree with, comment on, discard, edit, use any of the proposed changes in this PR.