All Projects → de-odex → suru

de-odex / suru

Licence: MIT License
A tqdm-style progress bar in Nim

Programming Languages

nim
578 projects

Projects that are alternatives of or similar to suru

angular-progress-bar
This component allow you to easy incorporate progress-bar to angular/ionic project, providing binding and color options
Stars: ✭ 26 (-35%)
Mutual labels:  progress-bar, progressbar
sound-garden
A personal journey into the audio synth domain
Stars: ✭ 21 (-47.5%)
Mutual labels:  nim-language, nim-lang
IJProgressView
A simple progress view written in Swift.
Stars: ✭ 70 (+75%)
Mutual labels:  progress-bar, progressbar
nim-package-directory
Nim package directory - documentation builder
Stars: ✭ 47 (+17.5%)
Mutual labels:  nim-language, nim-lang
DownloadPorgressBar
This is a download progressbar.
Stars: ✭ 19 (-52.5%)
Mutual labels:  progress-bar, progressbar
RxActivityIndicator-Android
A small library that helps you keep track of operations progress. It allows you to show progress bar (indicator) in a convenient way.
Stars: ✭ 12 (-70%)
Mutual labels:  progress-bar, progressbar
react-sweet-progress
A way to quickly add a progress bar to react app 🌈
Stars: ✭ 250 (+525%)
Mutual labels:  progress-bar, progressbar
React Nprogress
⌛️ A React primitive for building slim progress bars.
Stars: ✭ 173 (+332.5%)
Mutual labels:  progress-bar, progressbar
mp-progress
专注于小程序圆环形进度条的小工具
Stars: ✭ 72 (+80%)
Mutual labels:  progress-bar, progressbar
GradientProgressView
一个简单的进度条控件
Stars: ✭ 15 (-62.5%)
Mutual labels:  progress-bar, progressbar
shell-progressbar
Make a progress bar GUI on terminal platform (Shell script)
Stars: ✭ 39 (-2.5%)
Mutual labels:  progress-bar, progressbar
Neel
A Nim library for making Electron-like HTML/JS GUI apps, with full access to Nim capabilities.
Stars: ✭ 144 (+260%)
Mutual labels:  nim-language, nim-lang
React Sweet Progress
A way to quickly add a progress bar to react app 🌈
Stars: ✭ 239 (+497.5%)
Mutual labels:  progress-bar, progressbar
circlebars
Add circular progress bars and countdown timers easily with circlebars Created by @itaditya. Demo at >
Stars: ✭ 38 (-5%)
Mutual labels:  progress-bar, progressbar
Alive Progress
A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
Stars: ✭ 2,940 (+7250%)
Mutual labels:  progress-bar, progressbar
LinearProgressView
A simple linear progress view for iOS
Stars: ✭ 103 (+157.5%)
Mutual labels:  progress-bar, progressbar
Radialprogressbar
Radial ProgressBar inspired by Apple Watch OS. It is highly Customisable
Stars: ✭ 141 (+252.5%)
Mutual labels:  progress-bar, progressbar
Progress Bar.sh
Simple & sexy progress bar for `bash`, give it a duration and it will do the rest.
Stars: ✭ 155 (+287.5%)
Mutual labels:  progress-bar, progressbar
ProBar
this script will allow you to configure a progress bar with a timer with other options
Stars: ✭ 0 (-100%)
Mutual labels:  progress-bar, progressbar
cli-progress
⌛ easy to use progress-bar for command-line/terminal applications
Stars: ✭ 672 (+1580%)
Mutual labels:  progress-bar, progressbar

suru

A tqdm-style progress bar in Nim

asciicast

the demo above uses this code (note that the api has since changed, refer to tests/tests.nim for updated code):

import unittest, os, sequtils, random
randomize()

test "random time test":
  for a in suru(toSeq(0..<100)):
    sleep((rand(99) + 1))

test "long time test":
  for a in suru([1, 2, 3, 5]):
    sleep(1000)

test "alternate long time test":
  sleep 1000
  var bar: SuruBar = initSuruBar(25)

  bar.start(4)

  for a in toSeq(1..1000):
    sleep 4
    if a mod 250 == 0:
      inc bar
    bar.update(50_000_000)

  bar.finish()

test "constant time test":
  for a in suru(toSeq(0..<100)):
    sleep(25)

test "v-shaped time test":
  for a in suru(toSeq(1..100) & toSeq(countdown(100, 1))):
    sleep(a)

test "increasing time test":
  for a in suru(toSeq(1..100)):
    sleep(a)

test "sinusoidal time test":
  for a in suru(toSeq(1..100)):
    sleep(int(sin(a.float / 5) * 50 + 50))

test "multi-bar test":
  echo "check if this line is removed by the bars"
  sleep 1000
  var bar: SuruBar = initSuruBar(25, 25)

  bar.start(1000, 40)

  for a in toSeq(1..1000):
    sleep 25
    inc bar
    if a mod 25 == 0:
      inc bar, 1
    bar.update(50_000_000)
    bar.update(50_000_000, 1)

  bar.finish()

  echo "check if this line is removed by the bars"

Usage

suru can be used in two ways:

import suru

for a in suru([20, 90, 120]):
  # do something
  discard

or

import suru

var bar: SuruBar = initSuruBar()
# pass in a positive integer if you want to change how many bars there are

bar[0].total = 3 # number of iterations

bar.setup()

for a in [20, 90, 120]:
  # do something

  inc bar # can be changed to increment n amount at a time
  # will increment all bars
  # use inc bar[0] if you only want to increment the first bar

  bar.update(50_000_000) # in nanoseconds, so the delay is 50 ms
  # will be clamped to at least 1 ms

bar.finish()

API Reference

TODO :(

Major To-do

the order bears no meaning

  • thread-safe
  • multi-bar support
  • formatting support
    • ascii-only version
    • custom text
  • stable api
    • might come soon, i need more opinions on the current api
  • iterator support
  • unicode checks
  • echoing within the loop
  • recursive support for suru macro
    • ex: (this should work like manually making a two-bar SuruBar)
import suru

for a in suru(...):
  # do something
  for b in suru(...):
    # do another thing

Dependencies

suru has no external Nim dependencies

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].