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

Fish Completions #125

Open
johnallen3d opened this issue Sep 15, 2024 · 4 comments
Open

Fish Completions #125

johnallen3d opened this issue Sep 15, 2024 · 4 comments

Comments

@johnallen3d
Copy link

When I try to use tab completions in Fish shell I see the following (Go lang) error:

xc despanic: COMP_POINT env should be integer, got:
                                                                                           
goroutine 1 [running]:
github.com/posener/complete/v2.Complete({0x1042e5481, 0x2}, {0x1043bfa00, 0x140000927a0})
        github.com/posener/complete/[email protected]/complete.go:79 +0x364
github.com/posener/complete/v2.(*Command).Complete(...)
        github.com/posener/complete/[email protected]/command.go:20
main.runMain()
        github.com/joerdav/xc/cmd/xc/main.go:186 +0x138
main.main()
        github.com/joerdav/xc/cmd/xc/main.go:39 +0x1c

note: xc des was existing text when I hit Tab

@joerdav
Copy link
Owner

joerdav commented Sep 16, 2024

Thanks @johnallen3d ! I'll get fish installed and chase this one down, I'm using a separate package for completion so might take a little bit of digging!

@joerdav
Copy link
Owner

joerdav commented Sep 17, 2024

Sorry for the less than ideal solution for now while I look into fixing this:

Please set your ~/.config/fish/completions/xc.fish to:

function __complete_xc
    set -lx COMP_POINT (commandline -C)
    set -lx COMP_LINE (commandline -cp)
    test -z (commandline -ct)
    and set COMP_LINE "$COMP_LINE "
    /Users/joe/go/bin/xc <<<< REPLACE WITH YOUR INSTALL LOCATION
end
complete -f -c xc -a "(__complete_xc)"

@johnallen3d
Copy link
Author

Thank you @joerdav! This is working for me. I've been bouncing between a machine with Bash and my local machine with Fish and keep forgetting not to use completion locally. 😁

@joerdav
Copy link
Owner

joerdav commented Sep 17, 2024

I need to replace the completion engine I think, seems to have been abandoned. Cobra seems good I think that would be a breaking change since it supports only double-dash flag names!

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

No branches or pull requests

2 participants