feature request: show a @task's default argument values in help message

Open
#1,048 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
cli

Research direction

Start by reproducing the documented inv --help foo output with the shown @task definition, then trace how task arguments become the Options section. Done means the help output shows each argument's default value without requiring the @task help parameter.

Written by the indexing model from the issue text.

Description

Would be great if the help message showed a task's default argument values.

@task
def foo(ctx, a: int = 0, b: str = "b"):
    """My function"""
    print(f"a: {a}, b: {b}")

Right now it doesn't.

$ inv --help foo
Usage: inv[oke] [--core-opts] foo [--options] [other tasks here ...]

Docstring:
  My function

Options:
  -a INT
  -b STRING

I can use the @task's help parameter, but it would be nice to show each arg's default value without needing that.

Dominant language
Python
Stars
4.8k
Forks
412
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pyinvoke/invoke

All issues in pyinvoke/invoke

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.