Add tab completion for fish shell #364

Merged
6543 merged 2 commits from noerw/tea:fish-completion into master 5 months ago
noerw commented 5 months ago

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 5 months ago
noerw added the
kind/enhancement
label 5 months ago
noerw added 1 commit 5 months ago
44762ec6e8
add fish tab completion

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.
Poster

@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 5 months ago
6543 added 1 commit 5 months ago
cee4448d62 CI restart
lunny approved these changes 5 months ago
6543 merged commit df724b4006 into master 5 months ago
6543 referenced this issue from a commit 5 months ago
6543 deleted branch fish-completion 5 months ago

Reviewers

6543 approved these changes 5 months ago
lunny approved these changes 5 months ago
continuous-integration/drone/pr Build is passing
The pull request has been merged as df724b4006.
Sign in to join this conversation.
Loading…
There is no content yet.