nushell / nushell/nu_scripts

RFC/Suggestion: Move fish-generated completions into 'experimental' label

Open
#1,123 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Nushell
Stars
1.3k
Forks
323
Avg merge
3h 34m
Merged PRs (30d)
4

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 to custom-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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting custom-completions/auto-generate/completions and its README, then search the repository for references to that path. Move the generated completions under custom-completions/experimental/fish-generated, or use an equally explicit limited-status location, and update affected references and documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
fish
Domain
cli
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.