Description
I have spent considerable time working on parse-fish.nu
, and I was successful in covering more cases.
But seeing how fish defines completions in fish code and logic makes me wonder if it's really viable. It feels like implementing a fish parser.
Let's look at some examples:
ninja.fish
is relatively short. We can cover most cases, but not all of them.
gnome-extensions.fish
is a more complex example with subcommand. It uses variables and then logic like --condition "not __fish_seen_subcommand_from $commands"
to define subcommand on commands not in $commands
. To cover this we already have to not only match simple identifiers, but logical operations. It also makes elaborate use of conditions with multiple and combined conditions.
Looking at the complex dotnet tool, dotnet.fish
has 420 lines, unlike the previous example defines subcommands of the first level cleanly via __fish_use_subcommand
, but then has to expand en elaborative logical tree in conditions to cover subcommand arguments of a subcommand hierarchy.
Covering __fish_seen_subcommand_from
correctly would require not only a linear interpretation of the command line, which seems to be a shortcoming of fish, but supposedly finds the keywords anywhere in the command line - not ordered.
There may be value in the parse-fish.nu
script as a demonstration and in the generated completions as a partial solution, but I would suggest we at least make their limited nature more obvious.
Currently, the generated scripts are under custom-completions/auto-generate
with a README noting limitations.
Expectations on nu_scripts/custom-completions
may be high, with contributed nu-native completions, and auto-generate
may imply more than we have, at least does not make it obvious the limited nature of them.
Given that a folder outside of custom-completions
seems inappropriate too, I suggest we
- move
custom-completions/auto-generate/completions
tocustom-completions/experimental/fish-generated
or a similar obvious indication like limited
or inferior
. Because I am not hopeful that these fish-sourced generated completions will ever be complete or be able to replace manual/other contributions.