Skip to content

idea: do the completion in python code #206

@ThomasWaldmann

Description

@ThomasWaldmann

Even with AI help, it is somehow painful to write completion code, e.g. for CLI option values - especially if their spec/type is non-trivial.

Guess shtab's audience is primarily python CLI tool developers who just want to have shell completions, but are not used to or do not like to write shell completion scripts (or preambles with support functions) on their own for N different shells they want to support.

I just had the idea that it might be nice to move that logic to python code (it then would also be independent of the shell), e.g.:

  • we want to complete borg create --compression=X, that option has a type of CompressionSpec
  • some shtab-generated preamble code could call back like borg completion --type=CompressionSpec --value=X
  • the python code in borg would then compute a list of valid completions (starting from X) and output them on stdout
  • the preamble code would use that / present it to the user

Metadata

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