Skip to content

Conversation

@ramsey
Copy link
Contributor

@ramsey ramsey commented Jul 28, 2020

Documentation for new multiline responses feature proposed in symfony/symfony#37683

@ramsey
Copy link
Contributor Author

ramsey commented Aug 11, 2020

Updated for changes made in symfony/symfony#37683

fabpot added a commit to symfony/symfony that referenced this pull request Aug 12, 2020
…ns (ramsey) This PR was merged into the 5.2-dev branch. Discussion ---------- [Console] allow multiline responses to console questions | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | n/a | License | MIT | Doc PR | symfony/symfony-docs#14002 By default, the question helper stops reading user input when it receives a newline character (i.e., when the user hits `ENTER` once). However, with this feature, developers may specify that the response to a question should allow multiline answers by passing `true` to `setMultiline()`. Multiline questions stop reading user input after receiving three newline characters in a row (i.e., the user hits `ENTER` three times) or an end-of-transmission control character (`Ctrl-D` on Unix systems or `Ctrl-Z` on Windows). If a user enters a newline character without input, control is returned to the question class, where the input may be validated to prompt the user again (in the case of a required question), or control may be passed along to the rest of the script. Commits ------- 0bf89cd [Console] allow multiline responses to console questions
character (i.e., when the user hits ``ENTER`` once). However, you may specify that
the response to a question should allow multiline answers by passing ``true`` to
:method:`Symfony\\Component\\Console\\Question\\Question::setMultiline`::

Copy link
Contributor

@noniagriconomie noniagriconomie Aug 12, 2020

Choose a reason for hiding this comment

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

i would just add something like:

// src/Command/MyCommand.php
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure what you mean.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Never mind. I see what you mean now. The context for your comment didn't show the lines below, so I thought you were talking about the lines above. 😁

None of the other examples on this page show an example name for their command script. If I add this here, should I also add it to the rest of the examples?

Copy link
Contributor

Choose a reason for hiding this comment

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

ho i did not figure that other have not
but yes i see a lot on code example the path file on top as a comment
it helps understanding in which file the class is and its meaning etc :)

but i do not know if you should update all others :s

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't disagree, but it's inconsistent with the rest of the examples in this file.

$question->setMultiline(true);

$answer = $helper->ask($input, $output, $question);
}
Copy link
Contributor

@noniagriconomie noniagriconomie Aug 12, 2020

Choose a reason for hiding this comment

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

missing a return here if i am not mistaken, or another // ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I copied from other examples in the docs, none of which include a return or // ... at the end of the method.

@xabbuh xabbuh added this to the 5.2 milestone Aug 21, 2020
@xabbuh
Copy link
Member

xabbuh commented Aug 21, 2020

Thank you for your first contribution to the Symfony documentation @ramsey.

@xabbuh xabbuh merged commit 6f8f04a into symfony:master Aug 21, 2020
@ramsey ramsey deleted the feature/console-multiline-response branch August 21, 2020 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment