https://github.com/graze/console-diff-renderer
Only write minimal changes to the console
https://github.com/graze/console-diff-renderer
console-tool php symfony-console
Last synced: 6 months ago
JSON representation
Only write minimal changes to the console
- Host: GitHub
- URL: https://github.com/graze/console-diff-renderer
- Owner: graze
- License: mit
- Created: 2017-06-07T13:37:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-06-01T07:55:06.000Z (over 3 years ago)
- Last Synced: 2025-04-16T19:34:50.263Z (6 months ago)
- Topics: console-tool, php, symfony-console
- Language: PHP
- Size: 71.3 KB
- Stars: 5
- Watchers: 11
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Console Diff Renderer
[](https://packagist.org/packages/graze/console-diff-renderer)
[](LICENSE.md)
[](https://travis-ci.org/graze/console-diff-renderer)
[](https://scrutinizer-ci.com/g/graze/console-diff-renderer/code-structure)
[](https://scrutinizer-ci.com/g/graze/console-diff-renderer)
[](https://packagist.org/packages/graze/console-diff-renderer)
Only render things that have changed to the console.
[](https://asciinema.org/a/9233umuuyo8gi0gifmnudjz26)
## Usage
```php
$output = new DiffConsoleOutput($existing);
$output->reWrite([
'first line',
'second line',
]);
$output->reWrite([
'first line here',
'second line',
]);
```
This will navigate the cursor to the end of `first line` and write ` here` then navigate the cursor back to the end.
- Supports Formatting
- Supports ANSI control codes
- Will wrap around based on the terminal size
- Can trim based on the terminal size
- Will only write the number of lines that are visible to the user
## Install
Via Composer
``` bash
$ composer require graze/console-diff-renderer
```
## Development
```bash
$ make build
```
### Testing
```bash
$ make test
```
### Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security
If you discover any security related issues, please email security@graze.com instead of using the issue tracker.
## Credits
- [Harry Bragg](https://github.com/h-bragg)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.