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

Add autocompletion for fish shell #5

Closed

Conversation

ryanwilsonperkin
Copy link

@ryanwilsonperkin ryanwilsonperkin commented Mar 6, 2019

Fixes #3
Adds support for fish using their guide for writing custom completions

I've managed to get this working smoothly on my machine using a Oclif tool and would love a couple of other testers.

Recording

asciicast

Details

Automatically detects the correct path to store fish completion files in using pkg-config to detect the "completionsdir" variable. This comes from the advice on that page:

If you are developing another program and would like to ship completions with your program, install them to the "vendor" completions directory. As this path may vary from system to system, the pkgconfig framework should be used to discover this path with the output of pkg-config --variable completionsdir fish.

This will operate slightly different than how bash and zsh operate. Since those shells require you to add lines to you .bashrc or .zshrc in order to source the functions file, they necessitated a "setup" file as well as a manual addition to the configs. fish on the other hand will automatically detect completions by name in the completions folder, and so does not require a setup script, or manual intervention by the user. We'll simply write the completions to the appropriate directory.

Since we're now dealing with three shells instead of two, I've refactored some of the index.ts module to rely on some private methods with switch/case statements instead of the ternary used previously.

@ryanwilsonperkin
Copy link
Author

@jdxcode hope this works out for your teammates running fish too

@ryanwilsonperkin
Copy link
Author

@RasPhilCo hi! Are you accepting pull requests for this project?

@RasPhilCo
Copy link
Contributor

@ryanwilsonperkin thanks for the PR! I'll have time to review this PR in-depth in a few days.

@ryanwilsonperkin
Copy link
Author

Thanks!

@ryanwilsonperkin
Copy link
Author

Hi @RasPhilCo, wanted to check in about this PR. Anything I can do to help?

@b4nst
Copy link

b4nst commented May 16, 2019

Any news on this ?

Copy link
Contributor

@RasPhilCo RasPhilCo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small change requested, but looking good!

src/commands/autocomplete/create.ts Outdated Show resolved Hide resolved
Also add debug logging about the path that we're writing to
@RasPhilCo
Copy link
Contributor

Looks great! We're missing test coverage though, will merge after that!

@DrSensor
Copy link

should this be closed in favor of #38?

@ryanwilsonperkin
Copy link
Author

Sure thing, this can be taken over in #38

@ryanwilsonperkin ryanwilsonperkin deleted the fish-autocomplete branch October 16, 2020 14:39
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

Successfully merging this pull request may close these issues.

Add fish auto complete
4 participants