Skip to content

Commit

Permalink
Prepare v2.1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed Feb 6, 2018
1 parent 1094b9a commit 61d1ccd
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
# Changelog

## 2.0.0 (2017-09-20)
## 2.1.0 (2018-02-05)

* Feature: Add support for binding custom functions to any key code
(#70 by @clue)

```php
$readline->on('?', function () use ($stdio) {
$stdio->write('Do you need help?');
});
```

* Feature: Add `addInput()` helper method
(#69 by @clue)

```php
$readline->addInput('hello');
$readline->addInput(' world');
```

## 2.0.0 (2018-01-24)

A major compatibility release to update this package to support all latest
ReactPHP components!
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# clue/stdio-react [![Build Status](https://travis-ci.org/clue/php-stdio-react.svg?branch=master)](https://travis-ci.org/clue/php-stdio-react)

Async, event-driven and UTF-8 aware console input & output (STDIN, STDOUT),
built on top of for [ReactPHP](https://reactphp.org).
Async, event-driven and UTF-8 aware console input & output (STDIN, STDOUT) for
truly interactive CLI applications, built on top of [ReactPHP](https://reactphp.org).

You can use this library to build truly interactive and responsive command
line (CLI) applications, that immediately react when the user types in
a line. Inspired by `readline`, but supports UTF-8 and interleaved I/O
(typing while output is being printed), history and autocomplete support
and takes care of proper TTY settings under the hood without requiring
any extensions or special installation.
a line or hits a certain key. Inspired by `ext-readline`, but supports UTF-8
and interleaved I/O (typing while output is being printed), history and
autocomplete support and takes care of proper TTY settings under the hood
without requiring any extensions or special installation.

**Table of contents**

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

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

if ($line === 'quit') {
$stdio->end();
Expand Down Expand Up @@ -231,7 +231,7 @@ The given text will be inserted just like the user would type in a text and as
such adjusts the current cursor position accordingly.
The user will be able to delete and/or rewrite the buffer at any time.
Changing the *user input buffer* can be useful for presenting a preset input to
the usser (like the last password attempt).
the user (like the last password attempt).
Simply pass an input string like this:

```php
Expand Down Expand Up @@ -291,7 +291,7 @@ measured in number of monospace cells.
Most *normal* characters (plain ASCII and most multi-byte UTF-8 sequences) take a single monospace cell.
However, there are a number of characters that have no visual representation
(and do not take a cell at all) or characters that do not fit within a single
cell (like some asian glyphs).
cell (like some Asian glyphs).
This method is mostly useful for calculating the visual cursor position on screen,
but you may also invoke it like this:

Expand Down Expand Up @@ -334,7 +334,7 @@ you may want to use something like this:
$stdio->on('data', function ($line) use ($readline) {
$line = rtrim($line);
$all = $readline->listHistory();

// skip empty line and duplicate of previous line
if ($line !== '' && $line !== end($all)) {
$readline->addHistory($line);
Expand Down Expand Up @@ -592,7 +592,7 @@ This project follows [SemVer](http://semver.org/).
This will install the latest supported version:

```bash
$ composer require clue/stdio-react:^2.0
$ composer require clue/stdio-react:^2.1
```

See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "clue/stdio-react",
"description": "Async, event-driven console input & output (STDIN, STDOUT), built on top of ReactPHP",
"description": "Async, event-driven console input & output (STDIN, STDOUT) for truly interactive CLI applications, built on top of ReactPHP",
"keywords": ["stdio", "stdin", "stdout", "interactive", "CLI", "readline", "autocomplete", "autocompletion", "history", "ReactPHP", "async"],
"homepage": "https://github.com/clue/php-stdio-react",
"license": "MIT",
Expand Down

0 comments on commit 61d1ccd

Please sign in to comment.