Skip to content
This repository has been archived by the owner on Jul 26, 2020. It is now read-only.
/ progressbar Public archive

Highly configurable progress bar for kotlin multiplatform and jvm

Notifications You must be signed in to change notification settings

GitAntoinee/progressbar

Repository files navigation

progressbar

Travis CI Bintray

Terminal-based progressbar for Kotlin multiplatform

Preview

JVM

Targets

For the moment, only JVM is available. Because coroutines are only available on the main thread in Kotlin Native.

Installation

The library is available on jcenter and jitpack. JCenter provides only stable releases whereas jitpack provide releases and snapshots.

repositories {
    jcenter() // Releases only
    maven("https://jitpack.io") // Releases and snapshots
}

Usage

The usage is very straightforward

ProgressBar(ticks = 0, maxTicks = 100).use { progressBar -> // ProgressBar.close() interrupt the threads
    progressBar.tick() // Increment ticks by 1
    progressBar.tickBy(10) // Increment ticks by 10
    progressBar.tickTo(100) // Set ticks to 100
}

Style

The styles let you make the progressbar nicer

  • COLORFUL_UNICODE ansi colors and unicode characters
  • UNICODE unicode characters
  • ASCII ascii characters
ProgressBar(ticks = 0, maxTicks = 100, style = ProgressBarStyle.COLORFUL_UNICODE).use { progressBar ->
    // ...
}

See preview above

Unit

While processing or downloading data, it can be a good idea to provide the unit.

// Note : the ticks are in KB
ProgressBar(ticks = 0, maxTicks = 100, unit = ProgressBarUnit.KB_TO_MB).use { progressBar ->
    // The ticks will be automatically converted from KB to MB
}

See preview above

For a custom unit, you can create your own ProgressBarUnit: ProgressBarUnit(unitName, unitSize)

Task name

You can add text at the beginning of the progress bar, with the task parameter.

ProgressBar(ticks = 0, maxTicks = 100, task = "Text").use { progressBar ->
    // ...
}

See preview above

About

Highly configurable progress bar for kotlin multiplatform and jvm

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages