carapace-sh / carapace-bin

multi-shell multi-command argument completer
https://carapace.sh
MIT License
974 stars 54 forks source link

npm completer #462

Open rsteube opened 3 years ago

rsteube commented 3 years ago

Command

npm

Description

npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency conflicts intelligently.

Homepage

https://www.npmjs.com/

Documentation

https://docs.npmjs.com/cli/

Repository

https://github.com/npm/cli

Complexity

L

Anything else?

No response

Tasks

test and fix completion

Polar

Fund with Polar

brunoroque06 commented 2 years ago

run-script works fine! But run, which is an alias for run-script, does not. It is not recognized as a command. I guess the generated file for run should be exactly the same as this one: https://github.com/rsteube/carapace-bin/blob/master/completers/npm_completer/cmd/runScript.go (?). Can I help somehow?

rsteube commented 2 years ago

You can add Aliases: []string{"run"} to the runScript command.

Here's an example: https://github.com/rsteube/carapace-bin/blob/master/completers/git_completer/cmd/blame.go#L13

brunoroque06 commented 2 years ago

Perfect, thanks! Just tested it locally, and it worked.