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

Minimal fish shell completions #524

Merged
merged 8 commits into from
Apr 13, 2019
Merged

Conversation

ev-dev
Copy link

@ev-dev ev-dev commented Mar 11, 2019

Initial Shell Completions

For fish shell only; contains completions for flags but does not include flag sub-options like language lists or subcommands.

From what I understand #482 took place because of bugs with completion autogeneration. I added the 'completions' directory to assets so that perhaps others will follow with ported or manually written bash/zsh completions.

evdev added 2 commits March 10, 2019 19:27
…oes not include flag sub-options like language lists or subcommands
…oes not include flag sub-options like language lists or subcommands
@cben
Copy link

cben commented Mar 27, 2019

Tested. Basically works.
Does not suffer from #372 problem — I can complete file names everywhere. Including places where strictly I shouldn't, e.g. bat --theme TAB which ideally would complete theme names not files. But perfect is the enemy of good...

@sharkdp
Copy link
Owner

sharkdp commented Apr 4, 2019

Thank you very much for your contribution!

My only "concern" with this is that it has to be maintained manually. Most contributors will probably not update the completions files when they change command-line options or change help texts (the same happens with the man page). This means that I have to remind people in the PRs or do it myself when I create a new release.

I'm inclined to merge this, but I'm not sure if I will always find the time to keep it up-to-date.

@sharkdp
Copy link
Owner

sharkdp commented Apr 4, 2019

Oh, before I merge this, we should definitely make sure that the completion file will be added to the release tarballs and Debian packages. See #391 for details.

bat.fish Outdated
@@ -0,0 +1,59 @@
# Fish Shell Completions (WIP)

# Place or symlink to $XDG_CONFIG_HOME/fish/completions/bat.fish ($XDG_CONFIG_HOME is usually set to ~/.config)
Copy link
Owner

Choose a reason for hiding this comment

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

I think this can be removed if we properly install this file?

bat.fish Outdated

complete -c bat -s m -l map-syntax -d "<from:to> Map a file extension or file name to an existing syntax"

# TODO: add completion for theme list
Copy link
Owner

Choose a reason for hiding this comment

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

bat --list-themes does produce a newline-separated list of theme names if it is run in non-interactive mode, i.e. if the output is piped somewhere.

@ev-dev
Copy link
Author

ev-dev commented Apr 12, 2019

I definitely understand the concern regarding future contributor updates @sharkdp, manually written completions would hopefully be a temporary workaround until some future upgrade of the autogeneration piece.

Until then, It might be worth adding a note in the readme or a quick CONTRIBUTING.md with some guidelines, I'd add it to this PR but I don't want to impose in that regard.

@ev-dev
Copy link
Author

ev-dev commented Apr 12, 2019

I pushed up some minor updates including working --theme autocompletion after that helpful note on piped --list-themes output

I tried getting the completions as part of release packages during testing but I don't have a lot of experience with cargo builds or how to include completions as part of an install for linux/windows (could probably figure out macOS tho if it just involves updating a brew formula or something)

@sharkdp sharkdp merged commit 1ba8540 into sharkdp:master Apr 13, 2019
@sharkdp
Copy link
Owner

sharkdp commented Apr 13, 2019

Thank you very much for the updates!

The deployment should hopefully work just like this.

@sharkdp
Copy link
Owner

sharkdp commented Aug 15, 2019

Can someone from this thread maybe help with actually shipping the fish completions in the Debian package (#554)?

Edit: I think I got it.

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.

3 participants