|
1 | 1 | # clue/stdio-react [](https://travis-ci.org/clue/php-stdio-react)
|
2 | 2 |
|
3 |
| -Async, event-driven and UTF-8 aware console input & output (STDIN, STDOUT), |
4 |
| -built on top of for [ReactPHP](https://reactphp.org). |
| 3 | +Async, event-driven and UTF-8 aware console input & output (STDIN, STDOUT) for |
| 4 | +truly interactive CLI applications, built on top of [ReactPHP](https://reactphp.org). |
5 | 5 |
|
6 | 6 | You can use this library to build truly interactive and responsive command
|
7 | 7 | line (CLI) applications, that immediately react when the user types in
|
8 |
| -a line. Inspired by `readline`, but supports UTF-8 and interleaved I/O |
9 |
| -(typing while output is being printed), history and autocomplete support |
10 |
| -and takes care of proper TTY settings under the hood without requiring |
11 |
| -any extensions or special installation. |
| 8 | +a line or hits a certain key. Inspired by `ext-readline`, but supports UTF-8 |
| 9 | +and interleaved I/O (typing while output is being printed), history and |
| 10 | +autocomplete support and takes care of proper TTY settings under the hood |
| 11 | +without requiring any extensions or special installation. |
12 | 12 |
|
13 | 13 | **Table of contents**
|
14 | 14 |
|
@@ -43,7 +43,7 @@ $stdio->getReadline()->setPrompt('Input > ');
|
43 | 43 |
|
44 | 44 | $stdio->on('data', function ($line) use ($stdio) {
|
45 | 45 | $line = rtrim($line, "\r\n");
|
46 |
| - var_dump($line); |
| 46 | + $stdio->write('Your input: ' . $line . PHP_EOL); |
47 | 47 |
|
48 | 48 | if ($line === 'quit') {
|
49 | 49 | $stdio->end();
|
@@ -231,7 +231,7 @@ The given text will be inserted just like the user would type in a text and as
|
231 | 231 | such adjusts the current cursor position accordingly.
|
232 | 232 | The user will be able to delete and/or rewrite the buffer at any time.
|
233 | 233 | Changing the *user input buffer* can be useful for presenting a preset input to
|
234 |
| -the usser (like the last password attempt). |
| 234 | +the user (like the last password attempt). |
235 | 235 | Simply pass an input string like this:
|
236 | 236 |
|
237 | 237 | ```php
|
@@ -291,7 +291,7 @@ measured in number of monospace cells.
|
291 | 291 | Most *normal* characters (plain ASCII and most multi-byte UTF-8 sequences) take a single monospace cell.
|
292 | 292 | However, there are a number of characters that have no visual representation
|
293 | 293 | (and do not take a cell at all) or characters that do not fit within a single
|
294 |
| -cell (like some asian glyphs). |
| 294 | +cell (like some Asian glyphs). |
295 | 295 | This method is mostly useful for calculating the visual cursor position on screen,
|
296 | 296 | but you may also invoke it like this:
|
297 | 297 |
|
@@ -334,7 +334,7 @@ you may want to use something like this:
|
334 | 334 | $stdio->on('data', function ($line) use ($readline) {
|
335 | 335 | $line = rtrim($line);
|
336 | 336 | $all = $readline->listHistory();
|
337 |
| - |
| 337 | + |
338 | 338 | // skip empty line and duplicate of previous line
|
339 | 339 | if ($line !== '' && $line !== end($all)) {
|
340 | 340 | $readline->addHistory($line);
|
@@ -592,7 +592,7 @@ This project follows [SemVer](http://semver.org/).
|
592 | 592 | This will install the latest supported version:
|
593 | 593 |
|
594 | 594 | ```bash
|
595 |
| -$ composer require clue/stdio-react:^2.0 |
| 595 | +$ composer require clue/stdio-react:^2.1 |
596 | 596 | ```
|
597 | 597 |
|
598 | 598 | See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.
|
|
0 commit comments