Skip to content

%(prog)s is not properly replaced #540

@singiamtel

Description

@singiamtel

When using %(prog)s, it doesn't display properly in the tab completion

I'm using Python 3.13, pip 25.0.1, argcomplete==3.6.2 on macOS M2 15.4.1 (24E263), if it helps

prog docs: https://docs.python.org/3/library/argparse.html#prog

Repro:

$ cat myprogram
#!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
import argparse
import argcomplete

parser = argparse.ArgumentParser()

parser.add_argument("-v", help="display %(prog)s version")

argcomplete.autocomplete(parser)
args = parser.parse_args()

$ ./myprogram -h
usage: myprogram [-h] [-v V]

options:
  -h, --help  show this help message and exit
  -v V        display myprogram version

$ ./myprogram -h
[./myprogram]
--help  -h  -- show this help message and exit
-v          -- display %(prog)s version

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions