Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Dotenv] Variable filter added to debug command #46502

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

Merged
merged 1 commit into from
Jul 20, 2022

Conversation

rmikalkenas
Copy link
Contributor

@rmikalkenas rmikalkenas commented May 30, 2022

Q A
Branch? 6.2
Bug fix? no
New feature? yes
Deprecations? no
Tickets -
License MIT
Doc PR Will prepare on implementation approval

For applications that use many environment variables there is no way to efficiently filter a single variable. Of course there is always a grep command, but with it you are loosing part of the information that symfony debug command provides.
Added a new name argument to the command, to be able to filter debug output by variable's name

Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this feature. It's consistent with debug:container and debug:router that allows filtering with an optional argument.

@rmikalkenas rmikalkenas force-pushed the ability-debug-single-env branch 2 times, most recently from 973fee1 to f501856 Compare May 30, 2022 17:45
@rmikalkenas
Copy link
Contributor Author

@GromNaN @94noni thanks for the comments, adjusted the code based on it

@rmikalkenas
Copy link
Contributor Author

P.S. added filtering not only by exact value, but by prefix as well. For example if there are more than one variable with same prefix in the name - it will be possible to filter by prefix and get all values with that prefix:)

Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the completion and tests.

I tested the command and I think a message should be displayed when none of the variables starts with the given name.

@rmikalkenas rmikalkenas force-pushed the ability-debug-single-env branch 2 times, most recently from af5e53c to 6e6cd83 Compare June 3, 2022 08:39
@rmikalkenas rmikalkenas requested a review from fabpot June 3, 2022 08:45
@rmikalkenas
Copy link
Contributor Author

rmikalkenas commented Jun 3, 2022

@fabpot updated, based on comments. The failing pipeline does not relate with my changes (except for the low-deps of 8.1 which is due to dependency of 5.4 symfony components)

@rmikalkenas rmikalkenas force-pushed the ability-debug-single-env branch from 6e6cd83 to d41e7a1 Compare June 23, 2022 12:32
Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be glad if this feature was approved.

Copy link
Member

@fabpot fabpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 small changes before we can merge.


<info>php %command.full_name%</info>

To get specific variable, specify its name:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, it can be the env name or part of the name, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with clarification: To get specific variable, specify its full or partial name:

@rmikalkenas rmikalkenas force-pushed the ability-debug-single-env branch from d41e7a1 to a754669 Compare July 18, 2022 12:26
@fabpot
Copy link
Member

fabpot commented Jul 20, 2022

Thank you @rmikalkenas.

@fabpot fabpot merged commit ca4615a into symfony:6.2 Jul 20, 2022
@rmikalkenas rmikalkenas deleted the ability-debug-single-env branch July 20, 2022 10:38
@chalasr
Copy link
Member

chalasr commented Jul 20, 2022

@rmikalkenas The testCompletion test added by this PR is failing under certain circumstances. Would you mind having a look?
To reproduce locally:
./phpunit src/Symfony/Component/Dotenv --filter testCompletion (all green when running the whole DebugCommandTest 🤷 )

@rmikalkenas
Copy link
Contributor Author

@rmikalkenas The testCompletion test added by this PR is failing under certain circumstances. Would you mind having a look? To reproduce locally: ./phpunit src/Symfony/Component/Dotenv --filter testCompletion (all green when running the whole DebugCommandTest shrug )

@chalasr thanks for informing! Sounds weird.. Will take a look!

fabpot added a commit that referenced this pull request Jul 22, 2022
…obal state (rmikalkenas)

This PR was merged into the 6.2 branch.

Discussion
----------

[Dotenv] Run test in a separate process to have clean global state

| Q             | A
| ------------- | ---
| Branch?       | 6.2
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #...
| License       | MIT
| Doc PR        | symfony/symfony-docs#...

A fix to comment: #46502 (comment)
cc @chalasr

Commits
-------

be3782c [Dotenv] Run test in a separate process to have clean global state
@fabpot fabpot mentioned this pull request Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants