File tree Expand file tree Collapse file tree 2 files changed +63
-1
lines changed
src/test/java/info/unterrainer/commons/cliutils/consoleprogressbar Expand file tree Collapse file tree 2 files changed +63
-1
lines changed Original file line number Diff line number Diff line change
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
+
1
7
# java-cli-utils
2
8
A collection of useful tools if you want to make a command line interface of some sorts.
3
9
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
+
4
66
## CliParser
5
67
6
68
This is a fluent wrapper over the Apache Commons CLI library.
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public void ProgressBarTest() throws InterruptedException {
42
42
}
43
43
44
44
@ Test
45
- @ Disabled
45
+
46
46
public void PercentGaugeTest () throws InterruptedException {
47
47
ConsoleProgressBar bar = ConsoleProgressBar .builder ()
48
48
.minValue (0d )
You can’t perform that action at this time.
0 commit comments