dojo / cli

:rocket: Dojo - command line tooling.
http://dojo.io
Other
26 stars 34 forks source link

Help options misleading when more than one command for a group #58

Closed agubler closed 7 years ago

agubler commented 7 years ago

If there are more than one command for a group the options reflect just one of the commands when using the dojo group -h, this is misleading.

Example, the first help output shows the two commands available under build but the options are only valid for the dojo build.

Command: dojo build -h

dojo build

Commands:
  dojo     Build dojo2 packages
  webpack  create a build of your application

Options:
  -h, --help     Show help                                             [boolean]
  -t, --type     type of build         [choices: "dev", "dist"] [default: "dev"]
  -v, --version  Show version number                                   [boolean]

Command: dojo build webpack -h

dojo build webpack

Options:
  -h, --help     Show help                                             [boolean]
  -w, --watch    watch and serve
  -p, --port     port to serve on when using --serve                    [number]
  -v, --version  Show version number                                   [boolean]

Command: dojo build dojo -h

dojo build dojo

Options:
  -h, --help     Show help                                             [boolean]
  -t, --type     type of build         [choices: "dev", "dist"] [default: "dev"]
  -v, --version  Show version number                                   [boolean]
rishson commented 7 years ago

I don't think group help should show any options other than defaults -h -v, e.g. dojo -h shows list of groups dojo someGroup shows full command help (inc all options) if only 1 command in the group, else shows the commands and default options :

dojo build

Commands:
  dojo     Build dojo2 packages
  webpack  create a build of your application

Options:
  -h, --help     Show help                                             [boolean]
  -v, --version  Show version number                                   [boolean]

and default options should always go at the end:

dojo build webpack

Options:
  -w, --watch    watch and serve
  -p, --port     port to serve on when using --serve                    [number]

  -h, --help     Show help                                             [boolean]
  -v, --version  Show version number                                   [boolean]
rishson commented 7 years ago

Actually, thinking about this some more, I think that -h when in a group should only show the options for that group, but when no group specified, e.g. dojo -h then show the non-group-specific options such as -h -v

agubler commented 7 years ago

Addressed by #85