[DX] Potential container:explore command #11303

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

Comments

Projects
None yet
10 participants
@weaverryan
Member

weaverryan commented Jul 5, 2014

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 from Potential container:explore command to [DX] Potential container:explore command Jul 5, 2014

@manuelj555

This comment has been minimized.

Show comment
Hide comment

👍

@sstok

This comment has been minimized.

Show comment
Hide comment
@sstok

sstok Jul 5, 2014

Contributor

👍

Contributor

sstok commented Jul 5, 2014

👍

@javiereguiluz

This comment has been minimized.

Show comment
Hide comment
@javiereguiluz

javiereguiluz Jul 5, 2014

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
Member

javiereguiluz commented Jul 5, 2014

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

This comment has been minimized.

Show comment
Hide comment
@weaverryan

weaverryan Jul 5, 2014

Member

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

Member

weaverryan commented Jul 5, 2014

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

[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.

agallou added a commit to agallou/symfony that referenced this issue Jul 6, 2014

[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.
@kaiwa

This comment has been minimized.

Show comment
Hide comment

agallou added a commit to agallou/symfony that referenced this issue Jul 12, 2014

[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.
@flip111

This comment has been minimized.

Show comment
Hide comment
@flip111

flip111 Jul 21, 2014

Contributor

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

Contributor

flip111 commented Jul 21, 2014

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

@apfelbox

This comment has been minimized.

Show comment
Hide comment
@apfelbox

apfelbox Jul 21, 2014

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?

Contributor

apfelbox commented Jul 21, 2014

@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

This comment has been minimized.

Show comment
Hide comment
@javiereguiluz

javiereguiluz Jul 21, 2014

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?
Member

javiereguiluz commented Jul 21, 2014

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

This comment has been minimized.

Show comment
Hide comment
@apfelbox

apfelbox Jul 21, 2014

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)
Contributor

apfelbox commented Jul 21, 2014

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

This comment has been minimized.

Show comment
Hide comment
@Cydonia7

Cydonia7 Aug 2, 2014

Contributor

👍 @apfelbox

Contributor

Cydonia7 commented Aug 2, 2014

👍 @apfelbox

agallou added a commit to agallou/symfony that referenced this issue Sep 7, 2014

[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.
@egulias

This comment has been minimized.

Show comment
Hide comment
@egulias

egulias Sep 16, 2014

Contributor

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.

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

[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.

agallou added a commit to agallou/symfony that referenced this issue Oct 2, 2014

[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.

fabpot added a commit that referenced this issue Oct 2, 2014

feature #11339 [FrameworkBundle] container:debug : list services if n…
…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 Oct 2, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment