Skip to content

Commit c298229

Browse files
committed
update readme
1 parent bd9eeaf commit c298229

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,68 @@
1+
![GitHub forks](https://img.shields.io/github/forks/UnterrainerInformatik/java-cli-utils?style=social) ![GitHub stars](https://img.shields.io/github/stars/UnterrainerInformatik/java-cli-utils?style=social) ![GitHub repo size](https://img.shields.io/github/repo-size/UnterrainerInformatik/java-cli-utils) [![GitHub issues](https://img.shields.io/github/issues/UnterrainerInformatik/java-cli-utils)](https://github.com/UnterrainerInformatik/java-cli-utils/issues)
2+
3+
[![license](https://img.shields.io/github/license/unterrainerinformatik/FiniteStateMachine.svg?maxAge=2592000)](http://unlicense.org) [![Travis-build](https://travis-ci.org/UnterrainerInformatik/java-cli-utils.svg?branch=master)](https://travis-ci.org/github/UnterrainerInformatik/java-cli-utils) [![Maven Central](https://img.shields.io/maven-central/v/info.unterrainer.commons/cli-utils)](https://search.maven.org/artifact/info.unterrainer.commons/cli-utils) [![Twitter Follow](https://img.shields.io/twitter/follow/throbax.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/throbax)
4+
5+
6+
17
# java-cli-utils
28
A collection of useful tools if you want to make a command line interface of some sorts.
39

10+
## Console-Progressbar
11+
12+
The console-progressbar is designed to show progress when writing long-running console-applications.
13+
It was designed to be used with consoles that support control-characters (like cmd) or that don't (Eclipse console implementation before Mars (4.5)).
14+
15+
It comes with three flavors:
16+
17+
#### SimpleInsertBar
18+
19+
Works with non-control-character enabled consoles.
20+
Uses a completely new line for adding progress-characters instead.
21+
22+
```java
23+
prefix: [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]
24+
##################################################
25+
```
26+
27+
#### ProgressBar
28+
29+
Your ASCII-progressbar.
30+
Uses the same line, requiring ASCII escape characters.
31+
32+
```java
33+
prefix: [########------------------------------------------]
34+
```
35+
36+
#### PercentGauge
37+
38+
Displays the percentage.
39+
Needs ASCII escape characters as well.
40+
41+
```java
42+
prefix: [ 72%]
43+
```
44+
45+
46+
47+
You may extend the visual representations by implementing new graphical variants.
48+
49+
### Example
50+
51+
```java
52+
ConsoleProgressBar bar = ConsoleProgressBar.builder().maxValue((double)list.size()).
53+
controlCharacterSupport(!isForFileOut).build();
54+
55+
int count = 0;
56+
for (String s : list) {
57+
doSomething(s);
58+
59+
bar.updateValue(++count).redraw(System.out);
60+
}
61+
62+
bar.complete().redraw(System.out);
63+
System.out.println("\n");
64+
```
65+
466
## CliParser
567

668
This is a fluent wrapper over the Apache Commons CLI library.

src/test/java/info/unterrainer/commons/cliutils/consoleprogressbar/ConsoleProgressBarTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void ProgressBarTest() throws InterruptedException {
4242
}
4343

4444
@Test
45-
@Disabled
45+
4646
public void PercentGaugeTest() throws InterruptedException {
4747
ConsoleProgressBar bar = ConsoleProgressBar.builder()
4848
.minValue(0d)

0 commit comments

Comments
 (0)