Add tab completion for fish shell #364

Merged
6543 merged 2 commits from noerw/tea:fish-completion into master 2021-05-23 20:42:21 +00:00
Member

as title, fixes #361

Handling of fish shell is different in urfave/cli; urfave/cli provides a generator for the shell script needed (probably because the fish completion syntax isn't flexible enough to let the application handle the completion at runtime? idk)

This means that the fish completion can become out of sync with the tea binary.
If we want to account for that, on each application run we need to

  • check if ~/.config/fish/conf.d/tea_completion.fish exists; if so
  • check if the tea version that wrote it is the currently running version
  • if not, rewrite the file.

Not sure this is worth the complexity & cost

It generates a completion that also suggests file names, which looks kinda messy: Didn't find a way around this, but there may be a way
grafik

as title, fixes #361 Handling of fish shell is different in urfave/cli; urfave/cli provides a generator for the shell script needed (probably because the fish `completion` syntax isn't flexible enough to let the application handle the completion at runtime? idk) This means that the fish completion can become out of sync with the tea binary. If we want to account for that, on each application run we need to - check if `~/.config/fish/conf.d/tea_completion.fish` exists; if so - check if the tea version that wrote it is the currently running version - if not, rewrite the file. Not sure this is worth the complexity & cost It generates a completion that also suggests file names, which looks kinda messy: Didn't find a way around this, but [there may be a way](https://github.com/urfave/cli/blob/5bb54ace578d17a134feb806f22163e7064ede87/fish.go#L160-L180) ![grafik](/attachments/b08541c9-0f37-4c70-a2e3-1ec9da15a430)
noerw added this to the v0.8.0 milestone 2021-05-20 12:48:45 +00:00
noerw added the
kind
enhancement
label 2021-05-20 12:48:45 +00:00
noerw added 1 commit 2021-05-20 12:48:46 +00:00
Some checks failed
continuous-integration/drone/pr Build is failing
44762ec6e8
add fish tab completion
Member

Cool, thanks!

Is there an easy way to install from a branch/PR? Happy to test it and provide feedback.

Cool, thanks! Is there an easy way to install from a branch/PR? Happy to test it and provide feedback.
Author
Member

@pat-s yeah, if you have go installed:

git clone https://gitea.com/gitea/tea
cd tea
make build # alternatively: go build .
./tea pr checkout 364
make build # alternatively: go build .
./tea autocomplete fish

if using tea for the checkout doesn't work out:

git fetch https://gitea.com/gitea/tea refs/pull/364/head
git checkout FETCH_HEAD
make build
./tea autocomplete fish
@pat-s yeah, if you have `go` installed: ```sh git clone https://gitea.com/gitea/tea cd tea make build # alternatively: go build . ./tea pr checkout 364 make build # alternatively: go build . ./tea autocomplete fish ``` if using tea for the checkout doesn't work out: ``` git fetch https://gitea.com/gitea/tea refs/pull/364/head git checkout FETCH_HEAD make build ./tea autocomplete fish ```
6543 approved these changes 2021-05-23 10:46:34 +00:00
6543 added 1 commit 2021-05-23 10:48:35 +00:00
All checks were successful
continuous-integration/drone/pr Build is passing
cee4448d62
CI restart
lunny approved these changes 2021-05-23 12:15:35 +00:00
6543 merged commit df724b4006 into master 2021-05-23 20:42:21 +00:00
6543 deleted branch fish-completion 2021-05-23 20:42:28 +00:00
Sign in to join this conversation.
No description provided.