Skip to content

Completion of environment variable names #172

Open
@mauvilsa

Description

When working in shells it is common to store values in environment variables, and most commands allow tab completion of environment variable names, for example:

$ echo $BASH_V<TAB>
$ echo $BASH_VERSI<TAB><TAB>
$BASH_VERSINFO  $BASH_VERSION
$ echo $BASH_VERSIO<TAB>
$ echo $BASH_VERSION

Unfortunately, when an shtab completion script is activated, the completion of environment variable names doesn't work. For instance take the following script:

from argparse import ArgumentParser
import shtab

parser = ArgumentParser()
parser.add_argument("--pid", type=int)
shtab.add_argument_to(parser, "--shell-completion")
print(parser.parse_args())

The following doesn't complete anything:

$ cli.py --pid $BASHP<TAB><TAB>

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions