Fix npm global flag usage (#166)

* fix global flag usage

* add comment

* Update packagemanager/npm_test.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Sahil Bansal <bansalsahil315@gmail.com>

* Update packagemanager/npm_test.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Sahil Bansal <bansalsahil315@gmail.com>

---------

Signed-off-by: Sahil Bansal <bansalsahil315@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Sahil Bansal
2026-02-16 16:55:23 +05:30
committed by GitHub
co-authored by Copilot
parent 6074080219
commit 442a974aaa
2 changed files with 38 additions and 0 deletions
+3
View File
@@ -121,6 +121,9 @@ func (npm *npmPackageManager) ParseCommand(args []string) (*ParsedCommand, error
flagSet.StringArrayVarP(&devPackages, "dev", "D", nil, "Install dev packages")
}
// Known only to prevent UnknownFlags mode from swallowing the next package arg.
flagSet.BoolP("global", "g", false, "Install packages globally")
err := flagSet.Parse(installArgs)
if err != nil {
return &ParsedCommand{Command: command}, nil