Add fish shell completions support #538
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's this?
Fish is a modern, popular non-UNIX compatible shell with lots of builtin features.
By supporting Fish we also expand support to Nu, another modern shell with Fish completions compatibility.
The Fish shell completions format is extremely simple (full documentation here).
In general, program-generated fish completion list is just a list of lines, where each item can be followed by an optional description, separated by a tab
\t
character.While in general Fish prefers a mostly-static completion list (see the documentation for more details), I think for simplicity's sake it's easier to just keep everything dynamic for now; it also has the upside of supporting non-
CaseApp
framework conformant projects likescala-cli
.What's included?
rc
file to load completions (yay modernity!). Instead we only need to install the completions file to the correct place.The default install location is
$XDG_CONFIG_HOME/fish/completions
, but this can be changed with the--output
/-o
flag.completions install
command might not even be needed.completionsInstall
andcompletionsUninstall
methods to the object.scala-cli
for example to just re-usecase-app
's implementation and not have to duplicate all the logic.