All Projects → toy → progress

toy / progress

Licence: MIT license
Class to show progress during script run

Programming Languages

ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to progress

CustomProgress
一款常见的进度条加载框架
Stars: ✭ 32 (-50%)
Mutual labels:  progress
tox-progress
This JavaScript library was made to easily create animated radial progress bars.
Stars: ✭ 13 (-79.69%)
Mutual labels:  progress
uot
🦁 A tiny setTimeout alternative with progress.
Stars: ✭ 43 (-32.81%)
Mutual labels:  progress
notion-tqdm
Progress Bar displayed in Notion like tqdm for Python
Stars: ✭ 64 (+0%)
Mutual labels:  progress
angular-progress-http
[DEPRECATED] Use @angular/common/http instead
Stars: ✭ 43 (-32.81%)
Mutual labels:  progress
ProBar
this script will allow you to configure a progress bar with a timer with other options
Stars: ✭ 0 (-100%)
Mutual labels:  progress
DataDigger
A dynamic dataviewer for your Progress / OpenEdge databases
Stars: ✭ 43 (-32.81%)
Mutual labels:  progress
mp-progress
专注于小程序圆环形进度条的小工具
Stars: ✭ 72 (+12.5%)
Mutual labels:  progress
life-progress
🚼->🚶->👻
Stars: ✭ 20 (-68.75%)
Mutual labels:  progress
ProgressView
Custom view scrollbar
Stars: ✭ 28 (-56.25%)
Mutual labels:  progress
GaugeProgressView
Tired of boring Android progress views? This one is amazing!
Stars: ✭ 17 (-73.44%)
Mutual labels:  progress
react-sweet-progress
A way to quickly add a progress bar to react app 🌈
Stars: ✭ 250 (+290.63%)
Mutual labels:  progress
bioinf-commons
Bioinformatics library in Kotlin
Stars: ✭ 21 (-67.19%)
Mutual labels:  progress
DevProgressView
自定义ProdressView-进度条动画
Stars: ✭ 17 (-73.44%)
Mutual labels:  progress
openedge-zext
OpenEdge ABL Extension for VSCode
Stars: ✭ 16 (-75%)
Mutual labels:  progress
ProgressText
A text progress bar with animation effect, highly customized.
Stars: ✭ 13 (-79.69%)
Mutual labels:  progress
arc-progress
🐳 Arc circular animation progress bar drawn by canvas, you can used in the react component, or no dependence.
Stars: ✭ 42 (-34.37%)
Mutual labels:  progress
Ring
圆环进度条,环形进度条
Stars: ✭ 52 (-18.75%)
Mutual labels:  progress
GradientProgress
A gradient progress bar (UIProgressView).
Stars: ✭ 38 (-40.62%)
Mutual labels:  progress
CustomProgress
自定义水平带百分比数字的进度条以及自定义圆形带百分比数字的进度条
Stars: ✭ 58 (-9.37%)
Mutual labels:  progress

Gem Version Build Status Code Climate Depfu Inch CI

progress

Show progress during console script run.

Installation

gem install progress

Usage

1000.times_with_progress('Counting to 1000') do |i|
  # do something with i
end

or without title:

1000.times_with_progress do |i|
  # do something with i
end

With array:

[1, 2, 3].with_progress('1…2…3').each do |i|
  # still counting
end

.each is optional:

[1, 2, 3].with_progress('1…2…3') do |i|
  # =||=
end

Nested progress

(1..10).with_progress('Outer').map do |a|
  (1..10).with_progress('Middle').map do |b|
    (1..10).with_progress('Inner').map do |c|
      # do something with a, b and c
    end
  end
end

You can also show note:

[1, 2, 3].with_progress do |i|
  Progress.note = i
  sleep 5
end

You can use any enumerable method:

[1, 2, 3].with_progress.map{ |i| 'do stuff' }
[1, 2, 3].with_progress.each_cons(3){ |i| 'do stuff' }
[1, 2, 3].with_progress.each_slice(2){ |i| 'do stuff' }
# …

Any enumerable will work:

(1..100).with_progress('Wait') do |i|
  # ranges are good
end

Dir.new('.').with_progress do |path|
  # check path
end

NOTE: progress gets number of objects using length, size, to_a.length or just inject and if used on objects which needs rewind (like opened File), cycle itself will not work.

Use simple blocks:

symbols = []
Progress.start('Input 100 symbols', 100) do
  while symbols.length < 100
    input = gets.scan(/\S/)
    symbols += input
    Progress.step input.length
  end
end

or just

symbols = []
Progress('Input 100 symbols', 100) do
  while symbols.length < 100
    input = gets.scan(/\S/)
    symbols += input
    Progress.step input.length
  end
end

NOTE: you will get WRONG progress if you use something like this:

10.times_with_progress('A') do |time|
  10.times_with_progress('B') do
    # code
  end
  10.times_with_progress('C') do
    # code
  end
end

But you can use this:

10.times_with_progress('A') do |time|
  Progress.step 5 do
    10.times_with_progress('B') do
      # code
    end
  end
  Progress.step 5 do
    10.times_with_progress('C') do
      # code
    end
  end
end

Or if you know that B runs 9 times faster than C:

10.times_with_progress('A') do |time|
  Progress.step 1 do
    10.times_with_progress('B') do
      # code
    end
  end
  Progress.step 9 do
    10.times_with_progress('C') do
      # code
    end
  end
end

Copyright

Copyright (c) 2008-2021 Ivan Kuchin. See LICENSE.txt for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].