npm / rfcs

Public change requests/proposals & ideation
Other
726 stars 238 forks source link

[RRFC] Decompose `bash` completions #756

Open dysbulic opened 7 months ago

dysbulic commented 7 months ago

Motivation ("The Why")

The result of running npm completion is a monolithic function for the entirety of the npm command. Contrast this with git which allows a definition like:

alias gp='git push'
__git_complete gp _git_push

How

Current Behaviour

The current npm completion only works for the base command.

Desired Behaviour

I could define:

alias nr='npm run'
__npm_complete nr _npm_run

And when I double tab after nr it would show me the available tasks (the behavior when double tabbing after npm run when completions are loaded) rather than listing the files in the current directory.

References