Skip to content

Commit

Permalink
Add example of multi bar with widths exceeding maximum terminal scree…
Browse files Browse the repository at this point in the history
…n width in ref to issue #28
  • Loading branch information
piotrmurach committed Jun 22, 2018
1 parent 164c0d1 commit 18d5231
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions examples/multi/width.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require_relative '../../lib/tty-progressbar'

bars = TTY::ProgressBar::Multi.new("main [:bar] :percent")

bar1 = bars.register "foo [:bar] :percent", total: 150
bar2 = bars.register "bar [:bar] :percent", total: 250
bar3 = bars.register "baz [:bar] :percent", total: 100

th1 = Thread.new { 150.times { sleep(0.1); bar1.advance } }
th2 = Thread.new { 250.times { sleep(0.1); bar2.advance } }
th3 = Thread.new { 100.times { sleep(0.1); bar3.advance } }

[th1, th2, th3].each(&:join)

0 comments on commit 18d5231

Please sign in to comment.