@@ -6,8 +6,8 @@ Cursor Helper
66
77.. versionadded :: 5.1
88
9- The :class: `Symfony\\ Component\\ Console\\ Cursor `
10- class was introduced in Symfony 5.1.
9+ The :class: `Symfony\\ Component\\ Console\\ Cursor ` class was introduced
10+ in Symfony 5.1.
1111
1212The :class: `Symfony\\ Component\\ Console\\ Cursor ` allows you to change the
1313cursor position in a console command. This allows you to write on any position
@@ -16,10 +16,11 @@ of the output:
1616.. image :: /_images/components/console/cursor.gif
1717 :align: center
1818
19-
2019.. code-block :: php
2120
22- // src/Commande/MyCommand.php
21+ // src/Command/MyCommand.php
22+ namespace App\Command;
23+
2324 use Symfony\Component\Console\Command\Command;
2425 use Symfony\Component\Console\Cursor;
2526 use Symfony\Component\Console\Input\InputInterface;
@@ -29,13 +30,14 @@ of the output:
2930 {
3031 // ...
3132
32- public function execute(InputInterface $input, OutputInterface $output)
33+ public function execute(InputInterface $input, OutputInterface $output): int
3334 {
3435 // ...
3536
3637 $cursor = new Cursor($output);
3738
38- // moves the cursor to a specific column and row position
39+ // moves the cursor to a specific column (1st argument) and
40+ // row (2nd argument) position
3941 $cursor->moveToPosition(7, 11);
4042
4143 // and write text on this position using the output
@@ -71,7 +73,8 @@ There are fews methods to control moving the command cursor::
7173 // same for left
7274 $cursor->moveLeft();
7375
74- // move the cursor to a specific position from its current position
76+ // move the cursor to a specific (column, row) position from the
77+ // top-left position of the terminal
7578 $cursor->moveToPosition(7, 11);
7679
7780You can get the current command's cursor position by using::
0 commit comments