Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated completions for Fish shell don't work for Spago #29

Open
postsolar opened this issue Oct 19, 2023 · 1 comment
Open

Generated completions for Fish shell don't work for Spago #29

postsolar opened this issue Oct 19, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@postsolar
Copy link

postsolar commented Oct 19, 2023

Describe the bug
Generated completions for Fish shell don't work for Spago

To Reproduce

> spago --fish-completion-script (which spago) > ~/.config/fish/completions/spago.fish
> source ~/.config/fish/config.fish
# and just in case
> source ~/.config/fish/completions/spago.fish

Expected behavior
Shell completions appear upon pressing tab etc.

Additional context
Fish 3.6.1
Spago v0.93.18

Generated script:

 function _bundle.js
    set -l cl (commandline --tokenize --current-process)
    # Hack around fish issue #3934
    set -l cn (commandline --tokenize --cut-at-cursor --current-process)
    set -l cn (count $cn)
    set -l tmpline --bash-completion-enriched --bash-completion-index $cn
    for arg in $cl
      set tmpline $tmpline --bash-completion-word $arg
    end
    for opt in (/home/me/.asdf/shims/spago $tmpline)
      if test -d $opt
        echo -E "$opt/"
      else
        echo -E "$opt"
      end
    end
end

complete --no-files --command bundle.js --arguments '(_bundle.js)'
@postsolar postsolar added the bug Something isn't working label Oct 19, 2023
@postsolar postsolar changed the title Generated completions for Fish shell don't work for Spago. Generated completions for Fish shell don't work for Spago Oct 19, 2023
@postsolar
Copy link
Author

After looking at it for a bit, I notice two things:

  1. I used PNPM to install spago and it bundles the package so the program name ends up being bundle.js. bundle.js is also what shows up in the output of spago --help. This is the case also with Bash and ZSH. If I use NPM as the installation method this problem doesn't show up.
  2. There is something wrong with the indexing. It generates args like --bash-completion-enriched --bash-completion-index 1 --bash-completion-word "spago build", where the index is always 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant