preact-cli icon indicating copy to clipboard operation
preact-cli copied to clipboard

Ambiguities with create command usage

Open jamesgeorge007 opened this issue 4 years ago • 1 comments

Do you want to request a feature or report a bug? This proposal aims at changing the current behavior of the create command.

What is the current behaviour? As specified in the docs, the create command expects the template-name and project-name (required arguments). However, the current implementation treats them as optional arguments. https://github.com/preactjs/preact-cli/blob/4acc8c7768936cd128998971e0e6d7425cd5c204/packages/cli/lib/index.js#L44

If the current behaviour is a bug, please provide the steps to reproduce.

$ preact create default

https://github.com/preactjs/preact-cli/blob/4acc8c7768936cd128998971e0e6d7425cd5c204/packages/cli/lib/commands/create.js#L209-L214

The current implementation checks for a --template flag, which doesn't exist; hence the prompt to choose preactjs-template shows up even though it is specified.

https://github.com/preactjs/preact-cli/blob/4acc8c7768936cd128998971e0e6d7425cd5c204/packages/cli/lib/commands/create.js#L81-L87

What is the expected behaviour?

preact create [project-name] [options]
  • It would be better to add a --template flag.
  • The --name flag is not required.

Please mention other relevant information. N/A

jamesgeorge007 avatar Jan 31 '21 18:01 jamesgeorge007

Sounds reasonable.

Feel free to submit a PR or something, otherwise I'll take a look when I get a block of time. I think I'll want to check over the other commands too just to make sure everything is matching up correctly.

rschristian avatar Feb 04 '21 04:02 rschristian