sezna / nps

NPM Package Scripts -- All the benefits of npm scripts without the cost of a bloated package.json and limits of json
MIT License
1.43k stars 93 forks source link

`-h` or `--help` do not list available scripts nor `help` command #180

Open wmertens opened 6 years ago

wmertens commented 6 years ago

Scripts file (or at least the relevant bits):

module.exports = {scripts: {
    default: 'nps dev',
[...]

The command executed:

nps -h

The output:

20000 $ nps -h
Usage: ../../../../bin/node_modules/nps/dist/bin/nps.js [options] <script>...

Commands:
  init        automatically migrate from npm scripts to nps
  completion  generate bash completion script

Options:
  --config, -c      Config file to use (defaults to nearest package-scripts.yml
                    or package-scripts.js)                             [default:
         "/path/to/my/package-scripts.js"]
  --silent, -s      Silent nps output                 [boolean] [default: false]
  --log-level, -l   The log level to use
                   [choices: "error", "warn", "info", "debug"] [default: "info"]
  --require, -r     Module to preload
  --scripts         Log command text for script        [boolean] [default: true]
  --help-style, -y  Choose the level of detail displayed by the help command
                           [choices: "all", "scripts", "basic"] [default: "all"]
  -h, --help        Show help                                          [boolean]
  -v, --version     Show version number                                [boolean]

Examples:
  ../../../../bin/node_modules/nps/dist/bi  Runs the `test` script then the
  n/nps.js test build                       `build` script
  ../../../../bin/node_modules/nps/dist/bi  Runs the `test` script and forwards
  n/nps.js "test --cover" "build --prod"    the "--cover" flag then the `build`
                                            script and forwards the "--prod"
                                            flag

Problem description:

This output does not include the section Available scripts that you get when you run nps help.

It also does not include the command help in the Commands: section, so you can't find that out without reading the documentation

Suggested solution:

-h and --help should also list available scripts. This is IMHO the least surprising UX.

kevjin commented 5 years ago

Hi @wmertens, thanks for the issue. I agree listing available scripts with -h or --help makes sense from a UX perspective, as well as having the help command in the Commands section. Would you be free to make a PR for this?