8000 [DX] Potential container:explore command · Issue #11303 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DX] Potential container:explore command #11303

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

Closed
weaverryan opened this issue Jul 5, 2014 · 11 comments
Closed

[DX] Potential container:explore command #11303

weaverryan opened this issue Jul 5, 2014 · 11 comments
Labels
DependencyInjection DX DX = Developer eXperience (anything that improves the experience of using Symfony)

Comments

@weaverryan
Copy link
Member

This relates to #11302, where container:debug has a lot of great information, but is difficult to use.

What about a new container:explore command, which would be interactive? For example:

Welcome! Search for a service by name or enter nothing to print out all services

Then I enter "log"

It prints

[0] logger
[1] monolog.handler.console
[2] monolog.handler.debug

Choose a number for more information on the service. Or hit enter to search for something else

I press "0". And it prints something similar to the container:debug logger output.

Thoughts?

@weaverryan weaverryan changed the title Potential container:explore command [DX] Potential container:explore command Jul 5, 2014
@manuelj555
Copy link

👍

@sstok
Copy link
Contributor
sstok commented Jul 5, 2014

👍

@javiereguiluz
Copy link
Member

What about improving container:debug command instead of introducing a new one? This is how it could work:

  1. No arguments (php app/console container:debug) It outputs all the service definitions (same behavior as the current command).
  2. Argument that matches a service name (php app/console container:debug logger) It outputs the detailed information of that service (same behavior as the current command).
  3. Argument that doesn't exactly match the name of a service (php app/console container:debug log). This is the new behavior and it would work exactly as proposed by @weaverryan

@weaverryan
Copy link
Member Author

Hmm, yea, I like it :). I might also propose putting a message at the bottom of situation (1), like:

To search for a service, re-run this command with a search term. container:debug log

agallou added a commit to agallou/symfony that referenced this issue Jul 6, 2014
… exacly the name argument

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#11303
| License       | MIT
| Doc PR        |

If we launch the command "container:debug log" and there is no
service nammed log, it will print something like this :

```
[0] logger
[1] monolog.handler.console
[2] monolog.handler.debug
```

After the service has been chosen, usual container:debug informations
are displayed.
agallou added a commit to agallou/symfony that referenced this issue Jul 6, 2014
… exacly the name argument

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#11303
| License       | MIT
| Doc PR        |

If we launch the command "container:debug log" and there is no
service nammed log, it will print something like this :

```
[0] logger
[1] monolog.handler.console
[2] monolog.handler.debug
```

After the service has been chosen, usual container:debug informations
are displayed.
@kaiwa
Copy link
kaiwa commented Jul 8, 2014

+1 @javiereguiluz

agallou added a commit to agallou/symfony that referenced this issue Jul 12, 2014
… exacly the name argument

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#11303
| License       | MIT
| Doc PR        |

If we launch the command "container:debug log" and there is no
service nammed log, it will print something like this :

```
[0] logger
[1] monolog.handler.console
[2] monolog.handler.debug
```

After the service has been chosen, usual container:debug informations
are displayed.
@flip111
Copy link
Contributor
flip111 commented Jul 21, 2014

Perhaps move functionality of https://github.com/egulias/ListenersDebugCommandBundle into core

@apfelbox
Copy link
Contributor

@javiereguiluz I like your idea.

What would happen if one service name is a substring of another service name?

mybundle.logger, logger, test.logger -> what is shown if I enter logger?

@javiereguiluz
Copy link
Member

In this case, the command would output the information for the logger service because it's an exact match. Do you propose to show in this case a message like "Other services with similar names: mybundle.logger, test.logger"?

Related to this, what we would do with typos and errors?

  • If the user types loger instead of logger, what would be the output?
  • If the user types logger.test instead of test.logger, what would be the output?

@apfelbox
Copy link
Contributor

Yeah, something like "[logger info] services with similar names: ..."

Typos & errors:

  1. can be solved with a simple autosuggestion using levenshtein
  2. could be solved but might make the search too permissive (= too much noise)

@Cydonia7
Copy link
Contributor
Cydonia7 commented Aug 2, 2014

👍 @apfelbox

agallou added a commit to agallou/symfony that referenced this issue Sep 7, 2014
… exacly the name argument

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#11303
| License       | MIT
| Doc PR        |

If we launch the command "container:debug log" and there is no
service nammed log, it will print something like this :

```
[0] logger
[1] monolog.handler.console
[2] monolog.handler.debug
```

After the service has been chosen, usual container:debug informations
are displayed.
@egulias
Copy link
Contributor
egulias commented Sep 16, 2014

Maybe this https://github.com/egulias/TagDebugCommandBundle can help, it lets search for tag attributes, and also defining your own filters. The lib with the logic is on its own, so the command container:debug --tag --filter name=test can be implemented easily for tags, and extended for service names.

agallou added a commit to agallou/symfony that referenced this issue Sep 25, 2014
… exacly the name argument

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#11303
| License       | MIT
| Doc PR        |

If we launch the command "container:debug log" and there is no
service nammed log, it will print something like this :

```
[0] logger
[1] monolog.handler.console
[2] monolog.handler.debug
```

After the service has been chosen, usual container:debug informations
are displayed.
agallou added a commit to agallou/symfony that referenced this issue Oct 2, 2014
… exacly the name argument

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#11303
| License       | MIT
| Doc PR        |

If we launch the command "container:debug log" and there is no
service nammed log, it will print something like this :

```
[0] logger
[1] monolog.handler.console
[2] monolog.handler.debug
```

After the service has been chosen, usual container:debug informations
are displayed.
fabpot added a commit that referenced this issue Oct 2, 2014
…o service match exacly the name argument (agallou)

This PR was merged into the 2.6-dev branch.

Discussion
----------

[FrameworkBundle] container:debug : list services if no service match exacly the name argument

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #11303
| License       | MIT
| Doc PR        |

If we launch the command "container:debug log" and there is no
service nammed log, it will print something like this :

```
[0] logger
[1] monolog.handler.console
[2] monolog.handler.debug
```

After the service has been chosen, usual container:debug informations
are displayed.

Commits
-------

16201b6 [FrameworkBundle] container:debug : list services if no service match exacly the name argument
@fabpot fabpot closed this as completed Oct 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DependencyInjection DX DX = Developer eXperience (anything that improves the experience of using Symfony)
Projects
None yet
Development

No branches or pull requests

10 participants
0