Skip to content

Commit 61d1ccd

Browse files
committed
Prepare v2.1.0 release
1 parent 1094b9a commit 61d1ccd

File tree

3 files changed

+32
-13
lines changed

3 files changed

+32
-13
lines changed

CHANGELOG.md

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
# Changelog
22

3-
## 2.0.0 (2017-09-20)
3+
## 2.1.0 (2018-02-05)
4+
5+
* Feature: Add support for binding custom functions to any key code
6+
(#70 by @clue)
7+
8+
```php
9+
$readline->on('?', function () use ($stdio) {
10+
$stdio->write('Do you need help?');
11+
});
12+
```
13+
14+
* Feature: Add `addInput()` helper method
15+
(#69 by @clue)
16+
17+
```php
18+
$readline->addInput('hello');
19+
$readline->addInput(' world');
20+
```
21+
22+
## 2.0.0 (2018-01-24)
423

524
A major compatibility release to update this package to support all latest
625
ReactPHP components!

README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# clue/stdio-react [![Build Status](https://travis-ci.org/clue/php-stdio-react.svg?branch=master)](https://travis-ci.org/clue/php-stdio-react)
22

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).
55

66
You can use this library to build truly interactive and responsive command
77
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.
1212

1313
**Table of contents**
1414

@@ -43,7 +43,7 @@ $stdio->getReadline()->setPrompt('Input > ');
4343

4444
$stdio->on('data', function ($line) use ($stdio) {
4545
$line = rtrim($line, "\r\n");
46-
var_dump($line);
46+
$stdio->write('Your input: ' . $line . PHP_EOL);
4747

4848
if ($line === 'quit') {
4949
$stdio->end();
@@ -231,7 +231,7 @@ The given text will be inserted just like the user would type in a text and as
231231
such adjusts the current cursor position accordingly.
232232
The user will be able to delete and/or rewrite the buffer at any time.
233233
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).
235235
Simply pass an input string like this:
236236

237237
```php
@@ -291,7 +291,7 @@ measured in number of monospace cells.
291291
Most *normal* characters (plain ASCII and most multi-byte UTF-8 sequences) take a single monospace cell.
292292
However, there are a number of characters that have no visual representation
293293
(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).
295295
This method is mostly useful for calculating the visual cursor position on screen,
296296
but you may also invoke it like this:
297297

@@ -334,7 +334,7 @@ you may want to use something like this:
334334
$stdio->on('data', function ($line) use ($readline) {
335335
$line = rtrim($line);
336336
$all = $readline->listHistory();
337-
337+
338338
// skip empty line and duplicate of previous line
339339
if ($line !== '' && $line !== end($all)) {
340340
$readline->addHistory($line);
@@ -592,7 +592,7 @@ This project follows [SemVer](http://semver.org/).
592592
This will install the latest supported version:
593593

594594
```bash
595-
$ composer require clue/stdio-react:^2.0
595+
$ composer require clue/stdio-react:^2.1
596596
```
597597

598598
See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "clue/stdio-react",
3-
"description": "Async, event-driven console input & output (STDIN, STDOUT), built on top of ReactPHP",
3+
"description": "Async, event-driven console input & output (STDIN, STDOUT) for truly interactive CLI applications, built on top of ReactPHP",
44
"keywords": ["stdio", "stdin", "stdout", "interactive", "CLI", "readline", "autocomplete", "autocompletion", "history", "ReactPHP", "async"],
55
"homepage": "https://github.com/clue/php-stdio-react",
66
"license": "MIT",

0 commit comments

Comments
 (0)