8000 SymfonyStyle better aligning multi-line blocks? · Issue #18564 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

SymfonyStyle better aligning multi-line blocks? #18564

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
wouterj opened this issue Apr 16, 2016 · 5 comments
Closed

SymfonyStyle better aligning multi-line blocks? #18564

wouterj opened this issue Apr 16, 2016 · 5 comments

Comments

@wouterj
Copy link
Member
wouterj commented Apr 16, 2016

Description

Currently, a multiline warning block looks like:

 [WARNING] Your Symfony Installer version is outdated.
 Execute the command "..." to get the latest version

 Downloading the Symfony Demo Application...

It's not very clear that the second line is part of the warning block.

Proposed Solutions

I propose to change this to:

 [WARNING] Your Symfony Installer version is outdated.
           Execute the command "..." to get the latest version

 Downloading the Symfony Demo Application...

Or:

 [WARNING] Your Symfony Installer version is outdated.
     Execute the command "..." to get the latest version

 Downloading the Symfony Demo Application...

Or indent the complete block:

    [WARNING] Your Symfony Installer version is outdated.
    Execute the command "..." to get the latest version

 Downloading the Symfony Demo Application...
@javiereguiluz
Copy link
Member

👍 and not only that: this technique should be applied to everything (that was the original intention). For example, a long comment should not be displayed like this:

// Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus eget libero
venenatis, suscipit lacus eu, volutpat nibh. Integer sit amet lacus nunc. Vestibulum
ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
Pellentesque habitant morbi tristique senectus et netus et malesuada fames
ac turpis egestas. Proin nec mauris sed velit iaculis luctus nec ut nisl.

But like this:

// Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus eget libero
// venenatis, suscipit lacus eu, volutpat nibh. Integer sit amet lacus nunc. Vestibulum
// ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
// Pellentesque habitant morbi tristique senectus et netus et malesuada fames
// ac turpis egestas. Proin nec mauris sed velit iaculis luctus nec ut nisl.
8000

@ghost
Copy link
ghost commented Apr 20, 2016

👍 Great idea!

@chalasr
Copy link
Member
chalasr commented May 22, 2016

I think that this should be the result for any block:

 [WARNING] Your Symfony Installer version is outdated.
           Execute the command "..." to get the latest version

 Downloading the Symfony Demo Application...

I have a WIP that is OK for typed block (warning, success, ...) using this solution. Example:

Is it correct or is there another one of the proposed solutions that should be used instead?

Comments would also become blocks using ' // ' as prefix:


Really interested for any suggestion.

@ghost
Copy link
ghost commented May 22, 2016

@chalasr This is Off-Topic - but may be interesting not just for me. How did you do the awesome color backgrounds for "INSERT" and "dev" branch left from the cursor?

Your solution looks great! 👍

@chalasr
Copy link
Member
chalasr commented May 22, 2016

@JHGitty Glad to hear that.

I use the ohmyzsh budspencer theme, nothing more (background colors are the default ones).
Don't forget the powerline font as said in the readme, it's required to make it works.

It is marked as obsolete so you should look at the new one depending on your needs.

fabpot added a commit that referenced this issue May 26, 2016
…ocks (chalasr)

This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #18879).

Discussion
----------

[Console] SymfonyStyle: Align multi-line/very-long-line blocks

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #18564
| License       | MIT
| Doc PR        | n/a

This PR makes all lines aligned in multi-line blocks.

Very-long-line block:
```php
SymfonyStyle::warning('Lorem ipsum...');
```

Before:
![before-1](http://image.prntscr.com/image/d8443d3a85924a0182a62bd6d3dc1086.png)
After:
![after-1](http://image.prntscr.com/image/dbbdd275bff140bdad06de336f032ec1.png)

Multi-line block:
```php
SymfonyStyle::success(['Lorem ipsum...', 'Lorem ipsum...', 'Lorem ipsum...']);
```

Before:
![before-2](http://image.prntscr.com/image/6d7c05b4ab3a42f0b0be652527aed7c8.png)
After:
![after-2](http://image.prntscr.com/image/bba017309f4a4dd09e0147d5917cb0ae.png)

Also @javiereguiluz pointed the case of `SymfonyStyle::comment()` in #18564, I needed to make it calling `SymfonyStyle::block()` with ` // ` as prefix to fit the first intention of this one.
So if this one is merged I'll propose the changes for comments in a second PR (out of this scope).

Commits
-------

963fe1d [Console] SymfonyStyle: Align multi-line/very-long-line blocks
@fabpot fabpot closed this as completed May 26, 2016
fabpot added a commit that referenced this issue May 30, 2016
…ine comments (chalasr)

This PR was merged into the 2.8 branch.

Discussion
----------

[Console] SymfonyStyle: Fix alignment/prefixing of multi-line comments

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Pointed in #18564 (comment).

Very-long-line comment:
```php
SymfonyStyle::comment('Lorem ipsum ...');
```

Before:
![](http://image.prntscr.com/image/9190081d7fd740a89d17a7247dbbb244.png)

After:
![](http://image.prntscr.com/image/109c8c19c1574172bc22199ac90b6dd6.png)

Multi-line comment:
```php
SymfonyStyle::comment(['Lorem ipsum...', 'Lorem ipsum...']);
```

Before:
![](http://image.prntscr.com/image/24228f7e89e647b3a5d66fd83c7216cd.png)

After:
![](http://image.prntscr.com/image/fe9320369fad45acab92564f0e5de344.png)

Commits
-------

1c94fea [Console] SymfonyStyle: Fix alignment/prefixing of multi-line comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
0