[Python] Add autocomplete for tcsh shell in python script using click

Discussão em 'Python' iniciado por Stack, Agosto 7, 2025.

  1. Stack

    Stack Membro Participativo

    I want to add autocomplete for tcsh on naval example of click: https://github.com/pallets/click/tree/main/examples/naval

    I started to add this:

    _tcsh_source = """\
    %(complete_func)s {
    response=
    }
    """

    @add_completion_class
    class TcshComplete(ShellComplete):
    name = "tcsh"
    source_template = _tcsh_source


    but I am not sure of _tcsh_source variable content.

    Directly in the shell, I will use a command similar to this (I did not add all the options):

    complete naval 'p/1/(mine ship)/' \
    'n/mine/(remove set)/' \
    'n/set/(--moored --drifting)/' \
    'n/ship/(move --new --shoot)/' \
    'c/"ship move --"/(speed)/'


    Is it feasible? If not is there another way to generate autocompletion for tcsh?

    Continue reading...

Compartilhe esta Página