I have noticed that the Composer-Ready Project Templates documentation inserts the -n (--no-interaction) parameter between composer and create-project.
Now, if someone searches for "composer create-project" as a string (site:drupal.org "composer create-project") they will get some hits on drupal.org, whereas if they search for site:drupal.org "composer -n create-project" they would get hits for some other pages.
It also looks like "composer -n create-project" as a string is used fairly rarely anywhere:
https://www.google.com/search?q=%22composer+create-project%22 (133.000 results)
https://www.google.com/search?q=%22composer+-n+create-project%22 (86 results)
Is it worth considering streamlining parameters to accommodate discoverability? I suggest that they be put at the end of the line, since I also think it is more reader-friendly to have the "action" commands (composer + create-project) stand side-by-side, uninterrupted by parameters like -n and -s dev, for an uninterrupted syntax like this:
tool > command > what > where + parameters
Currently
composer -n create-project drupal/recommended-project my-project
Better?
composer create-project drupal/recommended-project my-project -n
Comments
Comment #2
ressaComment #4
ressaI put the parameters at the very end in my suggestion after finding #3085075: Add '-s dev' to Composer Project Template documentation so instructions work w/out a stable release, since it sounds to me like
-s devwill at some point no longer be needed.Comment #5
ressaComment #6
ressaComment #7
mmjvb commentedIt is better to remove it completely. Should be replaced with --prefer-dist.
Do agree with documenting the options at the end of the command. Just disagree on using --no-interaction|-n when using composer interactively.
Comment #8
ressaThanks for the support for putting parameters at the end of the command @mmjvb. Perhaps you could consider creating an issue under Project: Drupal core, Component: composer about the benefits of using
--prefer-distover using--no-interaction|-n?Comment #9
mmjvb commentedThe composer initiative is already aware of it.
Comment #10
mile23If we ask Composer for help with create-project, it tells us this:
So that means the docs say we should do
composer create-project --option-here pack/age dir.This fits with the desired outcome of making the docs more searchable if your search term is "composer create-project site:drupal.org".
Also, as @mmjvb points out in the docs discussion, we really shouldn’t be passing
--no-interactionin the documentation anyway.Regarding
--prefer-dist, it’s true that it’s the best way to avoid a question about what to do with a .git directory, but we also currently don’t download any packages that way. It’s probably safe to say that we’ll involve one that way in the future, so let’s add it. If it’s not strictly necessary, nothing bad will happen, but if it is, then we might avoid fielding another repeat of the question about ‘it asked me what to do, how should I answer?’Also, we should link to the docs for
composer create-project.Based on that, I'll go change the docs. :-)
Comment #11
mile23I made these changes: https://www.drupal.org/node/2718229/revisions/view/11698350/11698505
Comment #12
mmjvb commentedIn addition look at https://symfony.com/doc/current/console/input.html
Comment #13
ressa@mmjvb:
@Mile23:
Sounds good to me, if you both agree that it is not good practice.
For fun I ran the
create-projectcommand without any options, which went straight through, without getting presented with a cryptic Composer "Keep/Yes/No/Always" prompt:I have created #3104445: Make Composer create-project As Lean As Possible (ALAP) to discuss options usage for this case, but also opening up for a more general discussion of applying the As Lean As Possible (ALAP) philosophy on all Composer commands, to reduce complexity.
Comment #14
hansfn commentedVery happy to see that we agree on removing the
-n/--no-interactionoption. I hope that we can agree on removing--prefer-disttoo (when-nis gone) to keep things simple.However, I don't think we should move the options to the end. This breaks with established standards for (Unix) commands and it breaks with the syntax given by the help command as Mile23 showed in comment 10.
Using
composer create-project --options-here pack/age dirwill make our docs searchable enough.Comment #21
smustgrave commentedDon't see any patch or MR to review.
Comment #22
ressaBack in the day, the
-nparameter was needed, which is mostly what this issue is about. But it is no longer needed, so I think this issue can be closed.