npm / npm/rfcs

[RRFC] Decompose `bash` completions

Open
#756 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
778
Forks
266
PR merge metrics
No merged PRs in 30d

Description

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

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 reading the current npm completion behavior and the referenced git Bash completion implementation. Define how a completion function for aliases such as nr='npm run' should be exposed, and consider the work complete when alias commands offer the same subcommand completions as their expanded npm commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.