Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[FrameworkBundle] Remove env var table from AboutCommand#34768

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:masterfromtuqqu:about-command-fit-to-screen
Dec 26, 2019
Merged

[FrameworkBundle] Remove env var table from AboutCommand#34768

nicolas-grekas merged 1 commit intosymfony:masterfromtuqqu:about-command-fit-to-screen
Dec 26, 2019

Conversation

@tuqqu
Copy link
Contributor

QA
Branch?master
Bug fix?no
New feature?-
Deprecations?-
Tickets-
LicenseMIT
Doc PR-

Fixed AboutCommand output by shortening environment variable value (replacing with...) to fit the screen width if the value is too long.

Right now all output is a mess if it does not fit in the terminal window.

@ro0NL
Copy link
Contributor

it's considerable to use the new Console dumper (#28898) for env var values, that would improve display as well.

The CliDumper hassetMaxStringWidth, so if we can pass such a value (as calculated here) we can depend on existing building blocks :)

something like

diff --git a/Command/AboutCommand.php b/Command/AboutCommand.phpindex b9fbe67..feee4e6 100644--- a/Command/AboutCommand.php+++ b/Command/AboutCommand.php@@ -12,6 +12,7 @@ namespace Symfony\Bundle\FrameworkBundle\Command;  use Symfony\Component\Console\Command\Command;+use Symfony\Component\Console\Helper\Dumper; use Symfony\Component\Console\Helper\Helper; use Symfony\Component\Console\Helper\TableSeparator; use Symfony\Component\Console\Input\InputInterface;@@ -90,12 +91,13 @@ EOT         ];          if ($dotenv = self::getDotenvVars()) {+            $dumper = new Dumper($io);             $rows = array_merge($rows, [                 new TableSeparator(),                 ['<info>Environment (.env)</>'],                 new TableSeparator(),-            ], array_map(function ($value, $name) {-                return [$name, $value];+            ], array_map(function ($value, $name) use ($dumper) {+                return [$name, $dumper($value, $maxLength)];             }, $dotenv, array_keys($dotenv)));         }

@nicolas-grekasnicolas-grekas changed the title[FrameworkBundle] Long envvar value shortened to fit screen in AboutC…[FrameworkBundle] Long envvar value shortened to fit screen in AboutCommandDec 3, 2019
@tuqqu
Copy link
ContributorAuthor

@ro0NL I'm not sure.Dumper::__invoke() does not allow to pass string's max length as the second parameter. Or are you suggesting to tweak its behaviour in this pr?

If so,dump's output is standing out with it's bright colours and double quotes from all the rest. Do we really want this?

If so, I could take a look into this.

@ro0NL
Copy link
Contributor

Or are you suggesting to tweak its behaviour in this pr?

yep :)

If so, dump's output is standing out with it's bright colours and double quotes from all the rest. Do we really want this?

IMHO yes, but perhaps post a screenshot to see what others think. Maybe it's too much indeed ... i was mostly triggered for being able to reuseCliDumper::setMaxStringWidth :)

tuqqu reacted with thumbs up emoji

@nicolas-grekasnicolas-grekas added this to thenext milestoneDec 3, 2019
@tuqqu
Copy link
ContributorAuthor

tuqqu commentedDec 3, 2019
edited
Loading

@ro0NL I decided against usingDumper since we would rely onCliDumper::setMaxStringWidth() and it is part ofVarDumper which is mostly a require-dev package, plus it adds a new dependency (on symfony/console).

So I rewrote it a bit and it looks quite nice. I added a pic
Screenshot 2019-12-03 at 23 33 12

Could you please review my code?

Copy link
Contributor

@ro0NLro0NL left a comment

Choose a reason for hiding this comment

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

decided against using Dumper since we would rely on CliDumper::setMaxStringWidth() and it is part of VarDumper which is mostly a require-dev package

good point, i forgot we need to account for the fallback implementation as well.

LGTM in general 👍

@tuqqu
Copy link
ContributorAuthor

@ro0NL fixed all

@nicolas-grekas
Copy link
Member

Not sure about this: while it improves the display, what if Ido want to get the full value, eg to copy/paste it somewhere else?

@ro0NL
Copy link
Contributor

ro0NL commentedDec 15, 2019
edited
Loading

from experience, i agreeabout can be over-cluttered with output. Typically access tokens & co completely break the table

image

the original intend was always "debugging"; give a hint about the actual values being used. Truncating does not defeat this purpose IMHO.

what if I do want to get the full value

bin/console debug:container --env-var APP_SECRET :)

@nicolas-grekas
Copy link
Member

Wouldn't it make more sense to just remove this table with env vars?
There is alreadybin/console debug:container --env-vars if one wants to display them.

@ro0NL
Copy link
Contributor

ro0NL commentedDec 15, 2019
edited
Loading

hmpf... yes. There's a subtle difference.. (envs managed by .env vs envs used in DI), but i agree it's not really significant.

Alternatively, what about displayingSYMFONY_DOTENV_VARS comma separated inabout, to not loose this feature (it's also shown in the webprofiler e.g.)

@ro0NL
Copy link
Contributor

ro0NL commentedDec 16, 2019
edited
Loading

i tend to agree we should remove the Environment table inabout. Actually the web profiler shows the server parameters used for that request (and highlights which are from .env)... this concept doesnt exists for the console.

The current table was a solution, prior to the later addeddebug:container --env-vars.

Also we imply this are the actual values in .env, which is false :) the feature replacement is looking at .env really 😅

@tuqqu
Copy link
ContributorAuthor

@ro0NL@nicolas-grekas ok, I see. I pushed a new commit which removes env var table completely.

Copy link
Contributor

@ro0NLro0NL left a comment

Choose a reason for hiding this comment

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

probably best to update the PR title

@tuqqutuqqu changed the title[FrameworkBundle] Long envvar value shortened to fit screen in AboutCommand[FrameworkBundle] Remove env var table from AboutCommandDec 18, 2019
Copy link
Member

@javiereguiluzjaviereguiluz left a comment

Choose a reason for hiding this comment

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

Arthur thanks for this contribution (and congrats for being your first Symfony contribution!). And thanks for your patience during the review process.

@nicolas-grekas
Copy link
Member

Thank you@tuqqu.

nicolas-grekas added a commit that referenced this pull requestDec 26, 2019
… (tuqqu)This PR was squashed before being merged into the 5.1-dev branch.Discussion----------[FrameworkBundle] Remove env var table from AboutCommand| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | -| Deprecations? | -| Tickets       | -| License       | MIT| Doc PR        | -Fixed AboutCommand output by shortening environment variable value (replacing with `...`) to fit the screen width if the value is too long.Right now all output is a mess if it does not fit in the terminal window.Commits-------6962da9 [FrameworkBundle] Remove env var table from AboutCommand
@nicolas-grekasnicolas-grekas merged commit6962da9 intosymfony:masterDec 26, 2019
@nicolas-grekasnicolas-grekas modified the milestones:next,5.1May 4, 2020
GromNaN added a commit to GromNaN/symfony that referenced this pull requestSep 2, 2021
GromNaN added a commit to GromNaN/symfony that referenced this pull requestSep 2, 2021
fabpot added a commit that referenced this pull requestSep 3, 2021
…ection was removed (GromNaN)This PR was merged into the 5.3 branch.Discussion----------[Framework] Clean "about" command help after Environment section was removedIn Symfony 5.1 the "Environment" section of "about" command was removed (see#34768). The help text needs to be updated as a consequence.The sentence "It will not be shown if no variables were found." is particularly puzzling since the section is never shown.| Q             | A| ------------- | ---| Branch?       | 5.3| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Tickets       |Fix#34768| License       | MITCommits-------a4306d2 Clean about command description after Environment section was removed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz approved these changes

+1 more reviewer

@ro0NLro0NLro0NL approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

5.1

Development

Successfully merging this pull request may close these issues.

5 participants

@tuqqu@ro0NL@nicolas-grekas@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp