Commit Graph

1 Commits

Author SHA1 Message Date
Jordan Harband
718e880890 [Fix] focused error on missing/invalid args for several subcommands
Previously a number of subcommands dumped the entire `nvm --help`
output (~100 lines) when arguments were missing or invalid,
drowning the real error.
Replace each dump with a short,
command-specific usage block that names the expected syntax and points to `nvm --help` for full help.
The exit code (127) is unchanged.

Affected subcommands:
- `nvm install` (no version + no .nvmrc)
- `nvm use`     (version unresolvable)
- `nvm run`     (no version + no .nvmrc)
- `nvm which`   (no version + no .nvmrc)
- `nvm cache`   (unknown subcommand)
- `nvm uninstall`         (wrong arg count)
- `nvm unalias`           (wrong arg count)
- `nvm install-latest-npm` (wrong arg count)
- `nvm reinstall-packages` / `nvm copy-packages` (wrong arg count)

The catch-all unknown-subcommand handler still dumps full help, since
in that case the user has no narrower context to be reminded about.

Refs #3755
2026-06-10 15:16:23 -07:00