Skip to content

Working fish completions for poetry run invoke <string> #86

Description

@xylix

an attempt was made with help from Gemini:

function __fish_complete_poetry_run_invoke
    set -l command (commandline -op)
    if contains invoke $command
        # Find the index of 'invoke' in the command line
        set -l invoke_index (contains -i invoke $command)
        # echo "" >&2
        # echo "invoke index: ($invoke_index)" >&2
        echo "whole command: ($command)" >&2
        echo "tokenized: ($(commandline -t))" >&2

        # Extract the arguments starting at 'invoke'
        set -l invoke_args $command[$invoke_index-1..]

        # Call the invoke completion function with the extracted arguments
        echo "invoke args: $invoke_args" >&2
        invoke --complete -- $invoke_args
    else
        # Fallback to default poetry run completions if 'invoke' isn't the target
        __fish_poetry_414c7c24113b31c9_complete_no_subcommand $argv
    end
end

complete --no-files -c poetry -n '__fish_complete_poetry_run_invoke' -a run

Problem: Could not get invoke --complete to complete stuff, it might be looking at argv or something?

  • Tried looking at invokes source code and enabling INVOKE_DEBUG=1 env var to figure stuff out but didn't get that far.

poetry run invoke t r<tab> sometimes compelted to run but unclear what command is running the compelte there.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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