Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: fish support #68

Closed
lofidevops opened this issue Dec 30, 2013 · 9 comments
Closed

Feature request: fish support #68

lofidevops opened this issue Dec 30, 2013 · 9 comments

Comments

@lofidevops
Copy link

Would it be possible to also support completions in fish? https://github.com/fish-shell/fish-shell

@kislyuk
Copy link
Owner

kislyuk commented Dec 30, 2013

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?

@lofidevops
Copy link
Author

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

@lofidevops
Copy link
Author

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

@kislyuk
Copy link
Owner

kislyuk commented Jan 2, 2014

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

@lofidevops
Copy link
Author

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.

@Lucretiel
Copy link

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)

@wernight
Copy link

wernight commented May 3, 2016

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

@volkov
Copy link
Contributor

volkov commented Jan 3, 2019

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.

volkov pushed a commit to volkov/argcomplete that referenced this issue Jan 3, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Jan 5, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Jan 5, 2019
@volkov volkov mentioned this issue Jan 5, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Jan 6, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Jan 6, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Jan 6, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Jan 6, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Jan 6, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Jan 6, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Jan 7, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Jan 7, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Jan 7, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Jan 7, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Feb 8, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Feb 8, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Feb 8, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Mar 5, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Mar 5, 2019
volkov pushed a commit to volkov/argcomplete that referenced this issue Mar 5, 2019
kislyuk pushed a commit that referenced this issue May 12, 2019
@kislyuk
Copy link
Owner

kislyuk commented May 12, 2019

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

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

No branches or pull requests

5 participants