dojo / cli

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

Passing build command only gets acknowledged if an app has been scaffolded #163

Closed JamesLMilner closed 7 years ago

JamesLMilner commented 7 years ago

Firstly, excited to start looking into Dojo 2, keep up the great work :) Happy to help with this issue if you have some hints on where to look.

Enhancement

Currently if you use the build command with a empty project using the dev built cli, you receive

Unknown argument: build

Which is slightly confusing as the example command is:

'dojo build -h' will give you the help for the 'build' group of commands.

It's almost seems like you can't receive help on commands you can't currently use. Maybe this is intended but feels a bit weird from an end developer perspective.

Package Version: 2.0.0-pre

Code

node ./dist/umd/bin/dojo.js build -h

or

dojo build -h

Expected behavior:

Help information for the build command regardless of in an initialized/scaffolded app or not.

Actual behavior:

Generic command line help information.

agubler commented 7 years ago

@JamesMilnerUK Thanks for getting involved in Dojo 2!

The @dojo/cli detects available commands from the projects node_modules using a couple of conventions. It will try to load any dependency that either starts dojo-cli-* or is in the @dojo npm namespace and starts with cli-.

It is these installed commands that actually provide the details used by the cli to display the help information. So it is indeed by design that the cli cannot provide help for commands that are not available (installed into node_modules).

Perhaps should enhance the help text to be clearer or not use a "real" command as the example?

JamesLMilner commented 7 years ago

@agubler thanks for getting back to me. Right, that certainly makes sense, thanks for clarifying. I think that there is some scope to potentially clarify this a little in the feedback message.

JamesLMilner commented 7 years ago

How about something like this?

export const helpEpilog = `For more information on any of these commands just run them with '-h'.

e.g. 'dojo build -h' will give you the help for the 'build' group of commands.

If a non-builtin command (e.g. build) appears missing from the command list, please ensure it is listed in package.json and correctly installed.`;
matt-gadd commented 7 years ago

@JamesMilnerUK sounds good to me 👍, fancy raising a pr? 😄