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

[generate:command] during the process of adding new services, impossible to exit using Enter. #3714

Closed
LOBsTerr opened this issue Jan 21, 2018 · 15 comments

Comments

@LOBsTerr
Copy link
Member

Issue title

Adding new services causing infinite loop, until the moment we add all available services.
Other command, which are using ServicesTrait, EventsTrait and other can be also affected

Problem/Motivation

Impossible to add some options using interaction

How to reproduce

We add the first service, then we push "Enter" button ... and again and again.

Details to include:

  • Console version 1.5.0

Solution

The problem is when we push "Enter" button on the first question we receive as result 0 and we exit the while loop, but if we enter the name of the first service and we push "Enter" button we receive 1.
Because of that we can't exit the loop.

  1. We can avoid default value for autocomplete value passing empty string
  2. Figure out, why on the second question enter return 1
@jmolivas
Copy link
Member

Fixed with PR at console-core hechoendrupal/drupal-console-core#292

@LOBsTerr
Copy link
Member Author

LOBsTerr commented Jan 22, 2018

@jmolivas The problem still exists

I have just merged the upstreams for core and DC. As you see I enter the first service and then can't exit using "Enter". I can't reopen the ticket, feel free to do it.


Type the service name or use keyup or keydown.
This is optional, press enter to continue

Enter your service [class_loader]:
class_loader
Enter your service [kernel]:

Enter your service [kernel]:

@jmolivas
Copy link
Member

@LOBsTerr Did you sync and symlink dupal-console and drupal-console-core repos?

@LOBsTerr
Copy link
Member Author

@jmolivas I have updated the code from references again. Still the same.

Yes, of course I have everything symlinked.
Check the screenshot. I insert the first command and the just press enter.
Also, there is output on symlinked directories.

screenshot from 2018-01-22 20-39-29

@jmolivas
Copy link
Member

jmolivas commented Jan 22, 2018

@LOBsTerr My bad. I was hiting enter without adding the first one and I was able to exit the loop.

Got it fixed now. Sending a PR in a few minutes.

@LOBsTerr
Copy link
Member Author

@jmolivas Super! Thanks. I tried to explain this, but probably used the wrong words. The next time I will add a screenshot directly!

@jmolivas
Copy link
Member

@LOBsTerr PR => #3728

@LOBsTerr
Copy link
Member Author

@jmolivas I have checked. It works. Thanks

If you want I can handle in other places

@jmolivas
Copy link
Member

@LOBsTerr that will be great. We only need to fix when this combination happens

$VAR_NAME = $this->getIo()->choiceNoList(
  $this->trans('...'),
  ARRAY_OPTIONS,
  null,
  true
);

When null is 3rd parameter and true is 4th

We need to replace null as empty string ''

@jmolivas
Copy link
Member

jmolivas commented Jan 22, 2018

@LOBsTerr I found it at the following classes:

  • src/Command/Generate/PluginBlockCommand.php
  • src/Command/Role/DeleteCommand.php
  • src/Command/Shared/FormTrait.php (twice)
  • src/Command/Shared/ProjectDownloadTrait.php (twice)
  • src/Command/Theme/UninstallCommand.php
  • src/Command/Theme/InstallCommand.php

@LOBsTerr
Copy link
Member Author

@jmolivas Thanks for information, I will fix it

@LOBsTerr
Copy link
Member Author

@jmolivas PR #3730
I have found another case:
src/Command/Migrate/ExecuteCommand.php

@lucacattan3o
Copy link

Hi there, I've the same problem on module install (drupal moi) and module download (drupa mod)
I can't exit the loop.

screen shot 2018-04-03 at 11 36 03

Many thanks for your work! This console is awesome.

@LOBsTerr
Copy link
Member Author

LOBsTerr commented Apr 3, 2018

@KoalaCoder I will take a look

@LOBsTerr
Copy link
Member Author

LOBsTerr commented Apr 3, 2018

@jmolivas Can you review this small PR #3855

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

3 participants