Giter Club home page Giter Club logo

Comments (9)

kislyuk avatar kislyuk commented on July 18, 2024 6

Fish support has been released in v1.10.0, please test.

from argcomplete.

volkov avatar volkov commented on July 18, 2024 5

Following code:

function __fish_myscript_complete
    set -x _ARGCOMPLETE 1
    set -x _ARGCOMPLETE_IFS \n
    set -x _ARGCOMPLETE_SUPPRESS_SPACE 1
    set -x _ARGCOMPLETE_SHELL fish
    set -x COMP_LINE (commandline -p)
    set -x COMP_POINT (string length (commandline -cp))
    set -x COMP_TYPE
    if set -q _ARC_DEBUG
        myscript 8>&1 9>&2 1>/dev/null 2>&1
    else
        myscript 8>&1 9>&2 1>&9 2>&1
    end
end
complete -c myscript -f -a '(__fish_myscript_complete)'

in ~/.config/fish/completions/myscript.fish works fine for me.

from argcomplete.

kislyuk avatar kislyuk commented on July 18, 2024

I don't use fish, and it's not a huge priority for me right now. I intend to do some work on it since both fish and zsh are great shells, but not if it takes a lot.

With this said, I need some help from a fish expert. (ha, ha.) From what I can see in the API docs, fish has no way to specify a custom completer function at all in its completion engine: http://fishshell.com/docs/current/commands.html#complete - is this right?

from argcomplete.

lofidevops avatar lofidevops commented on July 18, 2024

I am quite new to fish I'm afraid. But on further review it looks like you may be right. The appropriate solution might be for a Python module to generate of fish completion scripts based on it's argparser, which sounds out of scope for argcomplete. The references I've found so far were:

And my own question on this topic: http://stackoverflow.com/questions/20838284/how-can-i-provide-tab-completions-to-fish-shell-from-a-python-script (current answer: stop bugging everyone and write your fish completion script :) )

I've posted a doc request/query at fish-shell: fish-shell/fish-shell#1217

from argcomplete.

lofidevops avatar lofidevops commented on July 18, 2024

See fish-shell/fish-shell#1217 (comment) for a suggestion on dynamic completions.

from argcomplete.

kislyuk avatar kislyuk commented on July 18, 2024

Cool - do you want to take a stab at adding fish support to https://github.com/kislyuk/argcomplete/blob/master/scripts/register-python-argcomplete?

from argcomplete.

lofidevops avatar lofidevops commented on July 18, 2024

I'm afraid I cannot commit to doing this - if I find some time I will submit a merge request, but if any other pescetarians are interested, please don't let me hold you up.

from argcomplete.

Lucretiel avatar Lucretiel commented on July 18, 2024

I will see if I can take a stab at this. As of at least 2.0, fish's complete method does support specifying a shell function as a custom completer (http://fishshell.com/docs/2.0/commands.html#complete)

from argcomplete.

wernight avatar wernight commented on July 18, 2024

A simpler alternative may be to generate man page (see https://bugs.python.org/issue14102) and then ask Fish to complete from man page.

from argcomplete.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.