Giter Club home page Giter Club logo

progressbar's Introduction

progressbar

Maven Central

A console progress bar for JVM with minimal runtime overhead.

Menlo, Fira Mono, Source Code Pro, Iosevka, JetBrains Mono or SF Mono 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

Installation

Maven:

  <dependency>
      <groupId>me.tongfei</groupId>
      <artifactId>progressbar</artifactId>
      <version>0.9.1</version>
  </dependency>

Usage

Declarative usage (since 0.6.0):

// 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):

// 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:

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.

Changelog

CHANGELOG

progressbar's People

Contributors

ctongfei avatar vehovsky avatar meawoppl avatar aluisioasg avatar heinrichreimer avatar neopaf avatar wfxr avatar abhinavvishak avatar andreinekrason avatar khmarbaise avatar kristofarkas avatar michaelsiepmann avatar mordechaim avatar zbateson avatar hlxid avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.