Skip to content
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

[RFC] The Symfony Console Style Guide #4265

Closed
javiereguiluz opened this issue Sep 24, 2014 · 64 comments
Closed

[RFC] The Symfony Console Style Guide #4265

javiereguiluz opened this issue Sep 24, 2014 · 64 comments
Labels
actionable Clear and specific issues ready for anyone to take them. Console good first issue Ideal for your first contribution! (some Symfony experience may be required)

Comments

@javiereguiluz
Copy link
Member

This is the proposal for the new Symfony Console Style Guide. Please review it as soon as you can, because the schedule is pretty tight. We'd like to update most of the commands for Symfony 2.6 version.

Download Symfony Console Style Guide (PDF, 89 KB)

@kbond
Copy link
Member

kbond commented Sep 24, 2014

I think there should always be 1 blank line before the result bar as well.

@javiereguiluz
Copy link
Member Author

@kbond good catch! I've just updated the PDF.

@wouterj
Copy link
Member

wouterj commented Sep 24, 2014

I like the direction the styleguide wants to guide you: Making outputs more consistent and clear. However, I don't like many concrete guides in the styleguide.

General

The behaviour of the current help command and the behaviour of the console component in general is based on the common standard defined as the docopt standard. I don't like it if we move away from that standard, the Symfony Styleguide should only extend it imo.

Specific points

  • Title hierarchy is shown using the same styles as Markdown - The markdown syntax with underlines only supports 2 levels, is this intended (to limit complexiness)? Otherwise, I would suggest the reSt Symfony standard.
  • I found the yellow dots to be confusing at first
  • Result bars being full width are mentioned twice in page 3
  • I don't like //. We can say there are 2 types of commands: Queries and Actions. For queries, the output of a command is the result of the query. In case of an action, the output is a message keeping the user up to date with the progress of the action. In both cases, the output is needed for the command to be user friendly.
    // indicates something that isn't needed in such cases, it has to be removed from the normal verbosity output and be moved to a more verbose output.
  • Avoid line overflows when the contents are too long - We should define an exact maximum line length imo
  • I'm -1 on putting the user input on a new line
  • For confirmation questions, the common convention is to use [nY] (where yes is the default). I would add that to the styleguide.

Please don't take this as an attack on you. I like the time you're putting into the Symfony community and I like it that you're doing the first step on this. However, I just wanted to share my thoughts on the exact guide. (and as always, it's just my opinion, do with it whatever you like :P).

@kbond
Copy link
Member

kbond commented Sep 24, 2014

I would like to see some additional examples for Questions:

  • Choice question
  • Confirmation question
  • Question with validation error

@kbond
Copy link
Member

kbond commented Sep 24, 2014

What about exceptions? How should they be styled?

@javiereguiluz
Copy link
Member Author

@kbond thanks for noticing all these missing things. Let's do a recap here:

  • Progress bars
  • Other types of questions: choice, confirmation, question with error validation)
  • Exceptions / Errors

@kbond
Copy link
Member

kbond commented Sep 24, 2014

Also, what about a "Warning" result bar that would be orange or yellow? Might be useful to show "OK but with some errors"

@javiereguiluz
Copy link
Member Author

@kbond any existing command that you are aware of that needs that Warning result bar? I'd like to analyze the use case. Thanks.

@kbond
Copy link
Member

kbond commented Sep 24, 2014

I can't think of any in Symfony core but I can think a use case in one of the bundles I maintain. zenstruck/cache-bundle has a command that warms up the http cache by hitting a list of urls. If all the urls return 200, I would show green, if some returned !200, I would show orange, if all returned !200 I would show red.

@ThomasLomas
Copy link
Contributor

I like this a lot. It will also help the community with keeping bundle commands consistent as well.

I like the question styles and it should also tie in nicely with symfony/symfony#11975 which shows the default answer to the user.

@javiereguiluz
Copy link
Member Author

@wouterj first, it's impossible that I consider your comment as a personal attack. Everything in the Symfony community is debatable and I repeatedly asked for feedback (positive or negative). Constructive criticism is what's making us win, so keep 'em coming :)

There are a lot of things in your comment, so let's break into three big parts:

Quick comments

  • Docopt: I don't understand this issue. The command help output is almost identical to that standard. Is there something else we could do?
  • Title hierarchy: the syntax is Markdown or RST because we want to limit headings to 2 levels. Otherwise, some developers will overcomplicate things.
  • Yellow dots: I don't know how to show the white spaces. I used the convention of IDEs. If someone is confused too: the yellow dots of the PDF are just for helping us; they won't appear in the console output.
  • Long lines: very good catch! We need to set a maximum line length for the text dispalyed in ultra wide console widths. I propose to use 120 chars for that limit.

User Input in new line

The rationale for this is showed in this illustration:

alignment

Creating a new line for user input allows us to show a perfect alignment. The eye of the user doesn't jump from one point to another to scan the values he/she typed.

In addition, keep in mind that questions may show the default values and the allowed values. This can produce ultra long question lines that can break user input (that's ugly and confusing):

long_questions

Information and debug messages

This is the most controversial part of the style guide so far. First, I confess that it's a completely personal opinion. I haven't seen this "feature" used anywhere.

Second, my rationale was like this: I like when things are self-explained. This is a title, this is an error message, this is the result of the command, etc. If this info messages don't include some distinctive design, they look like: "hey, here it is some random text. Who knows what's this?

See the illustration for a visual explanation:

command_output_parts

@javiereguiluz
Copy link
Member Author

I've just uploaded a new version which includes the Progress Bar styles.

@kbond
Copy link
Member

kbond commented Sep 24, 2014

A lot of commands add or remove files. Should the style guide contain standards for displaying this?

@javiereguiluz
Copy link
Member Author

@kbond in my opinion:

  • If adding/removing files is just one of multiple operations, display it as info message (// created ...)
  • If adding/removing files is the main operation, show it as a result ([OK] Created ...)

@kbond
Copy link
Member

kbond commented Sep 24, 2014

For the progress bar, the UTF-8 characters look weird on linux (for me anyway).

shot

Guess it has to do with the font, when I use the default system font it looks better (not great imo)

shot

@javiereguiluz
Copy link
Member Author

@kbond it looks awful! Thanks for reporting this error. Any Linux/Mac expert knows which are the correct UTF-8 characters to use for creating good looking progress bar.

@stof
Copy link
Member

stof commented Sep 25, 2014

Be careful about using UTF-8 chars for the progressbar: they won't work on Windows

@javiereguiluz
Copy link
Member Author

@stof I don't forget about you :) That's why we define different styles for Windows and Mac/Linux (See page 9 of the guide):

progress_bar_chars

@cordoval
Copy link
Contributor

linux and mac look uglier, can we have the windows style on mac? it feels more at home

@stof
Copy link
Member

stof commented Sep 25, 2014

yeah, I saw it when reading again the updated style guide. We should make them the defaults in the ProgressBar class though, to make it easy

@javiereguiluz
Copy link
Member Author

@cordoval it's true that the current style guide should be improved. But I also think that the Windows style is ugly. Anyway, in the Linux world we've had beautiful progress bars since forever. That's why I'm asking for help to any Linux expert who knows what are the UTF8 chars to use.

@cordoval
Copy link
Contributor

if it is like brew it would be nice, i think as similar as possible to the standard and beautiful would be a 👍 oh wait nah, it is ugly with ############### signs, so you are good!

@javiereguiluz
Copy link
Member Author

@kbond @wouterj the style guide has been updated with:

  • A new [WARNING] result type.
  • New styles for all kinds of questions (confirmation, multiple choice, etc.)
  • The only pending thing is the style of the progress bar.

Sorry for the massive pinging, but I'd love to read the opinions (positive or negative) of the rest of Symfony Core (@webmozart, @Tobion, @romainneutron, @nicolas-grekas, @jakzal) and other heavy users of the console (@pgodel, @hhamon, @pborreli, @jderusse, @lyrixx, @xabbuh, @weaverryan, @ricardclau, @mmoreram, @raulfraile, @aferrandini):

Download Symfony Console Style Guide v 0.89 (PDF, 126 KB)

@stof
Copy link
Member

stof commented Sep 25, 2014

I'm not a fan of the 1 space indentation. It makes it harder to write commands, because you have to add an extra space in each place where you wrap your messages. What is the reason to ask for it ?

@stof
Copy link
Member

stof commented Sep 25, 2014

For the multi-choice question, be careful that your proposal does not work everywhere. It requires running it a stty to be able to implement it. For Windows or other non-stty environments, the current way where you enter a number to choose the option will need to be kept. See symfony/symfony#11326 for the related PR

@hhamon
Copy link
Contributor

hhamon commented Sep 25, 2014

Hi Javier,

I really like the work you've done with this document.

I agree with most of the propositions. They look consistent to me for the usage experience but I can't tell for the development experience as long as I need to give a try to some of them.

Regarding the note section, I would suggest to have a light background color like for the caution one.

@kbond
Copy link
Member

kbond commented Sep 25, 2014

For the admonitions, should the text on lines 2+ be indented to match the first line? I saw you did this for multi-line question validation errors.

@javiereguiluz
Copy link
Member Author

@stof about the 1 space indent, the rationale is: this is a pure aesthetic decision. I propose to add this space because things look better (in my opinion) and it allows us to get a perfect alignment of all elements.

Regarding the comment about how hard would be to write commands, thanks to these new helpers the effort should be exactly the same, because the developer would never deal with these aesthetic details.

@kbond
Copy link
Member

kbond commented Oct 3, 2014

For the caution admonitions, exceptions and result bars, can we pad the blocks vertically. I find them too thin.

@javiereguiluz
Copy link
Member Author

@kbon could you please share a quick screenshot to better visualize the problem? Thanks!

@kbond
Copy link
Member

kbond commented Oct 3, 2014

Screenshots:

screen1

screen2

screen3

@javiereguiluz
Copy link
Member Author

You are right, they are too thin :( The problem is that adding a 1 line padding above and bellow could be too much. What do you think?

@fabpot
Copy link
Member

fabpot commented Oct 3, 2014

Adding a line above and below seems crucial to me.

@kbond
Copy link
Member

kbond commented Oct 3, 2014

I don't think it is required for the note admonition as there is no background color.

@javiereguiluz
Copy link
Member Author

@kbond agree! Only when the content has a background color.

@kbond
Copy link
Member

kbond commented Oct 3, 2014

FYI - the new progressbar style looks bad on my console:

screen

@javiereguiluz
Copy link
Member Author

@kbond yes. Anyway, I guess that we can do style tweaks during the stabilization phase. We'll have to check colors and revisit other controversial elements of the style guide.

@javiereguiluz
Copy link
Member Author

@kbond for the progress bar, can we make it of the same color as the text? (it should be displayed white in your black console, but it should be black/dark gray for users with light consoles)

@matthieuauger
Copy link
Contributor

Hi,

Nice work, consistency between console outputs will be great for DX.
What is missing here ? Has the Style Guide already been validated ?

@xabbuh
Copy link
Member

xabbuh commented Feb 6, 2015

@javiereguiluz Is there any news about this?

@javiereguiluz
Copy link
Member Author

@xabbuh no news at all :( @kbond did a great work transforming this PDF guide into actual code and he created new console methods for commands, but there seems to be no interest in updating all the framework's commands (which is a lot of work by the way).

@xabbuh
Copy link
Member

xabbuh commented Feb 6, 2015

@javiereguiluz Can you give a quick overview of what you think would be the next steps? As far as I understand, the guide is finished and people could start reworking all commands. Is that right?

fabpot added a commit to symfony/symfony that referenced this issue Mar 30, 2015
…(kbond)

This PR was squashed before being merged into the 2.7 branch (closes #14057).

Discussion
----------

[RFC][Console] Added console style guide helpers (v2)

*(Rebased to 2.7)*

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12014, #12035, symfony/symfony-docs#4265
| License       | MIT
| Doc PR        | todo

## Proposed API

### Code

```php
// Symfony command
protected function execute(InputInterface $input, OutputInterface $output)
{
    $output = new SymfonyStyle($output);

    $output->title('Lorem Ipsum Dolor Sit Amet');
    $output->text(array(
        'Duis aute irure dolor in reprehenderit in voluptate velit esse',
        'cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat'
    ));
    $output->ln();

    $output->table(array('Name', 'Method', 'Scheme', 'Host', 'Path'), array(
            array('admin_post_new', 'ANY', 'ANY', 'ANY', '/admin/post/new'),
            array('admin_post_show', 'GET', 'ANY', 'ANY', '/admin/post/{id}'),
            array('admin_post_edit', 'ANY', 'ANY', 'ANY', '/admin/post/{id}/edit'),
            array('admin_post_delete', 'DELETE', 'ANY', 'ANY', '/admin/post/{id}'),
        ));

    $output->caution(array(
            'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.',
            'foo'
        ));
    $output->section('Consectetur Adipisicing Elit Sed Do Eiusmod');
    $output->listing(array(
        'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod, tempor incididunt ut labore et dolore magna aliqua.',
        'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo.',
        'Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
    ));

    $customValidator = function ($value) {
        if ($value == 'foo') {
            throw new \Exception('cannot be foo');
        }

        return $value;
    };

    // hidden question
    $output->note($output->askHidden('Hidden question'));

    // choice questions
    $output->note($output->choice('Choice question no default', array('choice1', 'choice2')));
    $output->note($output->choice('Choice question with default', array('choice1', 'choice2'), 'choice1'));

    // confirmation questions
    $output->note($output->confirm('Confirmation with yes default', true) ? 'yes' : 'no');
    $output->note($output->confirm('Confirmation with no default', false) ? 'yes' : 'no');

    // standard questions
    $output->note($output->ask('Question no default'));
    $output->note($output->ask('Question no default and custom validator', null, $customValidator));
    $output->note($output->ask('Question with default', 'default'));
    $output->note($output->ask('Question with default and custom validator', 'default', $customValidator));

    $output->note('Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat.');
    $output->success('Lorem ipsum dolor sit amet, consectetur adipisicing elit');
    $output->error('Duis aute irure dolor in reprehenderit in voluptate velit esse.');
    $output->warning('Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi.');

    $output->progressStart(100);

    for ($i = 0; $i < 100; $i++) {
        usleep(10000);
        $output->progressAdvance();
    }

    $output->progressFinish();
}
```

### Output

```
$ php app/console command

Lorem Ipsum Dolor Sit Amet
==========================

 // Duis aute irure dolor in reprehenderit in voluptate velit esse
 // cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat

 ------------------- -------- -------- ------ -----------------------
  Name                Method   Scheme   Host   Path
 ------------------- -------- -------- ------ -----------------------
  admin_post_new      ANY      ANY      ANY    /admin/post/new
  admin_post_show     GET      ANY      ANY    /admin/post/{id}
  admin_post_edit     ANY      ANY      ANY    /admin/post/{id}/edit
  admin_post_delete   DELETE   ANY      ANY    /admin/post/{id}
 ------------------- -------- -------- ------ -----------------------

 ! [CAUTION] Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
 ! dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris. Lorem ipsum dolor sit amet,
 ! consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
 ! veniam, quis nostrud exercitation ullamco laboris.
 !
 ! foo

Consectetur Adipisicing Elit Sed Do Eiusmod
-------------------------------------------

 * Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod, tempor incididunt ut labore et dolore magna aliqua.

 * Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo.

 * Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Hidden question:
 > <f><o><o><enter>

 ! [NOTE] foo

 Choice question no default:
  [0] choice1
  [1] choice2
 > <enter>

 [ERROR] Value "" is invalid

 Choice question no default:
  [0] choice1
  [1] choice2
 > 0<enter>

 ! [NOTE] choice1

 Choice question with default [choice1]:
  [0] choice1
  [1] choice2
 > 1<enter>

 ! [NOTE] choice2

 Confirmation with yes default (yes/no) [yes]:
 > <enter>

 ! [NOTE] yes

 Confirmation with no default (yes/no) [no]:
 > <enter>

 ! [NOTE] no

 Question no default:
 > <enter>

 [ERROR] A value is required.

 Question no default:
 > foo<enter>

 ! [NOTE] foo

 Question no default and custom validator:
 > foo<enter>

 [ERROR] cannot be foo

 Question no default and custom validator:
 > <enter>

 [ERROR] A value is required.

 Question no default and custom validator:
 > foo<enter>

 [ERROR] cannot be foo

 Question no default and custom validator:
 > bar<enter>

 ! [NOTE] bar

 Question with default [default]:
 > <enter>

 ! [NOTE] default

 Question with default and custom validator [default]:
 > <enter>

 ! [NOTE] default

 ! [NOTE] Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
 ! Excepteur sint occaecat cupidatat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
 ! fugiat nulla pariatur. Excepteur sint occaecat cupidatat. Duis aute irure dolor in reprehenderit in voluptate velit
 ! esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat.

 [OK] Lorem ipsum dolor sit amet, consectetur adipisicing elit

 [ERROR] Duis aute irure dolor in reprehenderit in voluptate velit esse.

 [WARNING] Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi.

 100/100 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

```

### Screenshots

![screen1](https://cloud.githubusercontent.com/assets/127811/4507077/53bc009c-4b09-11e4-937c-44fe7fe30dc0.png)

![screen2](https://cloud.githubusercontent.com/assets/127811/4507078/53bf982e-4b09-11e4-8b5a-8c44c20ae4d9.png)

![screen](https://cloud.githubusercontent.com/assets/127811/6848451/b2e64848-d3a3-11e4-9916-43bd377684ca.png)

Commits
-------

96b4210 [RFC][Console] Added console style guide helpers (v2)
fabpot added a commit to symfony/console that referenced this issue Mar 30, 2015
…(kbond)

This PR was squashed before being merged into the 2.7 branch (closes #14057).

Discussion
----------

[RFC][Console] Added console style guide helpers (v2)

*(Rebased to 2.7)*

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12014, #12035, symfony/symfony-docs#4265
| License       | MIT
| Doc PR        | todo

## Proposed API

### Code

```php
// Symfony command
protected function execute(InputInterface $input, OutputInterface $output)
{
    $output = new SymfonyStyle($output);

    $output->title('Lorem Ipsum Dolor Sit Amet');
    $output->text(array(
        'Duis aute irure dolor in reprehenderit in voluptate velit esse',
        'cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat'
    ));
    $output->ln();

    $output->table(array('Name', 'Method', 'Scheme', 'Host', 'Path'), array(
            array('admin_post_new', 'ANY', 'ANY', 'ANY', '/admin/post/new'),
            array('admin_post_show', 'GET', 'ANY', 'ANY', '/admin/post/{id}'),
            array('admin_post_edit', 'ANY', 'ANY', 'ANY', '/admin/post/{id}/edit'),
            array('admin_post_delete', 'DELETE', 'ANY', 'ANY', '/admin/post/{id}'),
        ));

    $output->caution(array(
            'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.',
            'foo'
        ));
    $output->section('Consectetur Adipisicing Elit Sed Do Eiusmod');
    $output->listing(array(
        'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod, tempor incididunt ut labore et dolore magna aliqua.',
        'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo.',
        'Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
    ));

    $customValidator = function ($value) {
        if ($value == 'foo') {
            throw new \Exception('cannot be foo');
        }

        return $value;
    };

    // hidden question
    $output->note($output->askHidden('Hidden question'));

    // choice questions
    $output->note($output->choice('Choice question no default', array('choice1', 'choice2')));
    $output->note($output->choice('Choice question with default', array('choice1', 'choice2'), 'choice1'));

    // confirmation questions
    $output->note($output->confirm('Confirmation with yes default', true) ? 'yes' : 'no');
    $output->note($output->confirm('Confirmation with no default', false) ? 'yes' : 'no');

    // standard questions
    $output->note($output->ask('Question no default'));
    $output->note($output->ask('Question no default and custom validator', null, $customValidator));
    $output->note($output->ask('Question with default', 'default'));
    $output->note($output->ask('Question with default and custom validator', 'default', $customValidator));

    $output->note('Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat.');
    $output->success('Lorem ipsum dolor sit amet, consectetur adipisicing elit');
    $output->error('Duis aute irure dolor in reprehenderit in voluptate velit esse.');
    $output->warning('Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi.');

    $output->progressStart(100);

    for ($i = 0; $i < 100; $i++) {
        usleep(10000);
        $output->progressAdvance();
    }

    $output->progressFinish();
}
```

### Output

```
$ php app/console command

Lorem Ipsum Dolor Sit Amet
==========================

 // Duis aute irure dolor in reprehenderit in voluptate velit esse
 // cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat

 ------------------- -------- -------- ------ -----------------------
  Name                Method   Scheme   Host   Path
 ------------------- -------- -------- ------ -----------------------
  admin_post_new      ANY      ANY      ANY    /admin/post/new
  admin_post_show     GET      ANY      ANY    /admin/post/{id}
  admin_post_edit     ANY      ANY      ANY    /admin/post/{id}/edit
  admin_post_delete   DELETE   ANY      ANY    /admin/post/{id}
 ------------------- -------- -------- ------ -----------------------

 ! [CAUTION] Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
 ! dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris. Lorem ipsum dolor sit amet,
 ! consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
 ! veniam, quis nostrud exercitation ullamco laboris.
 !
 ! foo

Consectetur Adipisicing Elit Sed Do Eiusmod
-------------------------------------------

 * Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod, tempor incididunt ut labore et dolore magna aliqua.

 * Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo.

 * Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Hidden question:
 > <f><o><o><enter>

 ! [NOTE] foo

 Choice question no default:
  [0] choice1
  [1] choice2
 > <enter>

 [ERROR] Value "" is invalid

 Choice question no default:
  [0] choice1
  [1] choice2
 > 0<enter>

 ! [NOTE] choice1

 Choice question with default [choice1]:
  [0] choice1
  [1] choice2
 > 1<enter>

 ! [NOTE] choice2

 Confirmation with yes default (yes/no) [yes]:
 > <enter>

 ! [NOTE] yes

 Confirmation with no default (yes/no) [no]:
 > <enter>

 ! [NOTE] no

 Question no default:
 > <enter>

 [ERROR] A value is required.

 Question no default:
 > foo<enter>

 ! [NOTE] foo

 Question no default and custom validator:
 > foo<enter>

 [ERROR] cannot be foo

 Question no default and custom validator:
 > <enter>

 [ERROR] A value is required.

 Question no default and custom validator:
 > foo<enter>

 [ERROR] cannot be foo

 Question no default and custom validator:
 > bar<enter>

 ! [NOTE] bar

 Question with default [default]:
 > <enter>

 ! [NOTE] default

 Question with default and custom validator [default]:
 > <enter>

 ! [NOTE] default

 ! [NOTE] Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
 ! Excepteur sint occaecat cupidatat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
 ! fugiat nulla pariatur. Excepteur sint occaecat cupidatat. Duis aute irure dolor in reprehenderit in voluptate velit
 ! esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat.

 [OK] Lorem ipsum dolor sit amet, consectetur adipisicing elit

 [ERROR] Duis aute irure dolor in reprehenderit in voluptate velit esse.

 [WARNING] Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi.

 100/100 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

```

### Screenshots

![screen1](https://cloud.githubusercontent.com/assets/127811/4507077/53bc009c-4b09-11e4-937c-44fe7fe30dc0.png)

![screen2](https://cloud.githubusercontent.com/assets/127811/4507078/53bf982e-4b09-11e4-8b5a-8c44c20ae4d9.png)

![screen](https://cloud.githubusercontent.com/assets/127811/6848451/b2e64848-d3a3-11e4-9916-43bd377684ca.png)

Commits
-------

96b4210 [RFC][Console] Added console style guide helpers (v2)
@wouterj
Copy link
Member

wouterj commented May 2, 2015

With the new styles now merged into the code and the core commands in progress of being updated, I think it's time to move this issue forward.

I think the best first step is to transform the latest PDF in this issue into reStructured Text formatting in the documentation. This way, we can easily discuss the guide and improve it.

@wouterj wouterj added good first issue Ideal for your first contribution! (some Symfony experience may be required) actionable Clear and specific issues ready for anyone to take them. Console labels May 2, 2015
@xabbuh
Copy link
Member

xabbuh commented May 2, 2015

@javiereguiluz Can you please add a link to the current (final) version of the style guide to your initial description? It would make it easier for people wanting to contribute to find the most recent version.

@javiereguiluz
Copy link
Member Author

We can close this as "fixed". The feature is implemented since Symfony 2.7 and the docs are published at https://symfony.com/doc/current/cookbook/console/style.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actionable Clear and specific issues ready for anyone to take them. Console good first issue Ideal for your first contribution! (some Symfony experience may be required)
Projects
None yet
Development

No branches or pull requests