pallets / pallets/click

feature: allow substituting command_path in command help and epilog text

Open
#2,683 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help output
Dominant language
Python
Stars
17.7k
Forks
2.3k
Avg merge
1d 30m
Merged PRs (30d)
18

Description

Given:

@click.command(help="Example: %(prog)s --do-this")
def cli(): pass

Will result in:

$ ./command --help
Example: ./command --do-this
$ python -m command --help
Example: python -m command --do-this

The problem is that it is not possible to template the command from within the help text itself. There is %(prog)s for version string, but not for help or epilog. It would be nice to have them there, also %(version)s.

Thank you, click is great.

Contributor guide

Open the contributing guide

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.

Research direction

Start by tracing Click's command help and epilog formatting, then compare it with the existing %(prog)s version-string substitution described in the issue. Done means help and epilog text can substitute the command path and version value, producing the corresponding values in the shown command-line examples.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.