8000 Shell completion doesn't work on scripts with a dot in name · Issue #2166 · pallets/click · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Shell completion doesn't work on scripts with a dot in name #2166
Closed
@ziima

Description

@ziima

I found out, that a shell completion doesn't work on scripts with a dot in their name, mainly the scripts themselves (without an entry point linked) or entry points with a dot in their name (less common). The main problem is that the dot is copied into the name of the completion variable.

MWE:
Let's have a script /tmp/example.py

import click


@click.command()
def main():
    pass


if __name__ == '__main__':
    main()

Completion on this script doesn't do anything using any of reasonable variable names:

_EXAMPLE_COMPLETE=bash_source python3 /tmp/example.py
_EXAMPLEPY_COMPLETE=bash_source python3 /tmp/example.py
_EXAMPLE_PY_COMPLETE=bash_source python3 /tmp/example.py

I found out, click requires the variable _EXAMPLE.PY_COMPLETE to be set, which is not possible (at least) in bash.

It would help if the dot was replaced by an underscore, the same way a dash is handled.

Environment:

  • Python version: 3.9.9
  • Click version: 8.0.3

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0