Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguities with create command usage #1523

Open
jamesgeorge007 opened this issue Jan 31, 2021 · 1 comment
Open

Ambiguities with create command usage #1523

jamesgeorge007 opened this issue Jan 31, 2021 · 1 comment

Comments

@jamesgeorge007
Copy link
Contributor

jamesgeorge007 commented Jan 31, 2021

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.

.command('create [template] [dest]')

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

$ preact create default

async function command(repo, dest, argv) {
validateArgs(argv, options, 'create');
// Prompt if incomplete data
if (!repo || !dest) {
const templates = await fetchTemplates();
const questions = requestParams(argv, templates);

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.

function requestParams(argv, templates) {
const cwd = resolve(argv.cwd);
return [
// Required data
{
type: argv.template ? null : 'select',

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

@rschristian
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants