Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ctongfei/progressbar
Terminal-based progress bar for Java / JVM
https://github.com/ctongfei/progressbar
cli console jvm progressbar terminal
Last synced: 2 days ago
JSON representation
Terminal-based progress bar for Java / JVM
- Host: GitHub
- URL: https://github.com/ctongfei/progressbar
- Owner: ctongfei
- License: mit
- Created: 2015-02-09T19:16:21.000Z (almost 10 years ago)
- Default Branch: main
- Last Pushed: 2024-11-14T20:50:26.000Z (28 days ago)
- Last Synced: 2024-12-03T09:05:28.052Z (9 days ago)
- Topics: cli, console, jvm, progressbar, terminal
- Language: Java
- Homepage: http://tongfei.me/progressbar/
- Size: 3 MB
- Stars: 1,093
- Watchers: 18
- Forks: 108
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ccamel - ctongfei/progressbar - Terminal-based progress bar for Java / JVM (Java)
README
# progressbar
[![Maven Central](https://img.shields.io/maven-central/v/me.tongfei/progressbar.svg?style=flat-square)](https://maven-badges.herokuapp.com/maven-central/me.tongfei/progressbar)A console progress bar for JVM with minimal runtime overhead.
Menlo,
[Fira Mono](https://github.com/mozilla/Fira),
[Source Code Pro](https://github.com/adobe-fonts/source-code-pro),
[Iosevka](https://github.com/be5invis/Iosevka),
[JetBrains Mono](https://www.jetbrains.com/lp/mono/) or
[SF Mono](https://developer.apple.com/fonts/) are recommended for optimal visual effects.For Consolas or Andale Mono fonts, use `ProgressBarStyle.ASCII` because the box-drawing glyphs are not aligned properly in these fonts.
#### Documentation
- [Documentation](http://ctongfei.github.io/progressbar/)
- [Javadoc](https://javadoc.io/doc/me.tongfei/progressbar/latest)
#### Installation
Maven:
```xml
me.tongfei
progressbar
0.10.0
```#### Usage
Declarative usage (since `0.6.0`):
```java
// Looping over a collection:
for (T x : ProgressBar.wrap(collection, "TaskName")) {
...
// Progress will be automatically monitored by a progress bar
}
```Imperative usage (since `0.7.0` switched to Java's try-with-resource pattern):
```java
// try-with-resource block
try (ProgressBar pb = new ProgressBar("Test", 100)) { // name, initial max
// Use ProgressBar("Test", 100, ProgressBarStyle.ASCII) if you want ASCII output style
for ( /* TASK TO TRACK */ ) {
pb.step(); // step by 1
pb.stepBy(n); // step by n
...
pb.stepTo(n); // step directly to n
...
pb.maxHint(n);
// reset the max of this progress bar as n. This may be useful when the program
// gets new information about the current progress.
// Can set n to be less than zero: this means that this progress bar would become
// indefinite: the max would be unknown.
...
pb.setExtraMessage("Reading..."); // Set extra message to display at the end of the bar
}
} // progress bar stops automatically after completion of try-with-resource block
```**NEW** in `0.9.0`: You can now use multiple progress bars for parallel jobs:
```java
try (ProgressBar pb1 = new ProgressBar("Job1", max1);
ProgressBar pb2 = new ProgressBar("Job2", max2)) { ... }
```##### Kotlin extensions
Kotlin DSL-like builders are available at [reimersoftware/progressbar-ktx](https://github.com/reimersoftware/progressbar-ktx).#### Changelog
[CHANGELOG](https://github.com/ctongfei/progressbar/blob/master/CHANGELOG.md)