Skip to content

Commit

Permalink
Add docs for unicode support in ref to issue #26
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Jun 21, 2018
1 parent f16966c commit f49962f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* Includes many predefined tokens to calculate ETA, Bytes ... [tokens](#41-tokens)
* Allows to define your [custom tokens](#42-custom-formatters)
* Supports parallel multi progress bars [multi](#6-ttyprogressbarmulti-api)
* Handles Unicode characters in progress bar [unicode](#44-unicode)
* Works on all ECMA-48 compatible terminals

## Installation
Expand Down Expand Up @@ -70,6 +71,7 @@ Or install it yourself as:
* [4.1 Tokens](#41-tokens)
* [4.2 Custom Formatters](#42-custom-formatters)
* [4.3 Custom Tokens](#43-custom-tokens)
* [4.4 Unicode](#44-unicode)
* [5. Logging](#5-logging)
* [6. TTY::ProgressBar::Multi API](#6-ttyprogressbarmulti-api)
* [6.1 new](#61-new)
Expand Down Expand Up @@ -474,6 +476,22 @@ which outputs:
(4) Bye Piotr!
```

### 4.4 Unicode

If your progress bar contains Unicode characters or multibyte characters that are not monospaced, you will need to add the following gem to your application as a dependency:

```ruby
gem 'unicode-display_width'
```

This will make it possible to specify Unicode chars, for example, for bar progression:

```ruby
bar = TTY::ProgressBar.new("Unicode [:bar]", total: 30, complete: '')
#
# => Unicode [あああああああああああああああ]
```

## 5. Logging

If you want to print messages out to terminal along with the progress bar use the `log` method. The messages will appear above the progress bar and will continue scrolling up as more are logged out.
Expand Down

0 comments on commit f49962f

Please sign in to comment.