You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Progress indicators for command line Clojure apps, including support for indeterminate tasks (those where progress cannot be measured) and determinate tasks (those where progress can be measured). The former are represented using "spinners", while the latter are represented using "progress bars".
11
+
Progress indicators for command line Clojure apps, including support for indeterminate tasks (those where progress _cannot_ be measured) and determinate tasks (those where progress _can_ be measured). The former are represented using "spinners", while the latter are represented using "progress bars".
12
12
13
-
##What is it useful for?
13
+
#### Why?
14
14
15
15
To give the user of a command line app a visual progress indicator during long running processes.
16
16
17
-
Here it is in action (from the unit tests):
17
+
Here it is in action (from the [demo script](https://github.com/pmonks/spinner/blob/dev/demo.clj)):
18
+
18
19
<palign="center">
19
20
<imgalt="Spinner example screenshot"src="https://raw.githubusercontent.com/pmonks/spinner/dev/spinner-demo.gif"/>
20
21
</p>
@@ -25,6 +26,10 @@ Note that using Unicode characters in progress indicators may be unreliable, dep
25
26
26
27
`spinner` is available as a Maven artifact from [Clojars](https://clojars.org/com.github.pmonks/spinner).
27
28
29
+
## Usage
30
+
31
+
[API documentation is available here](https://pmonks.github.io/spinner/). The [unit](https://github.com/pmonks/spinner/blob/release/test/progress/indeterminate_test.clj)[tests](https://github.com/pmonks/spinner/blob/release/test/progress/determinate_test.clj) provide comprehensive usage examples (alternative animation sets, formatting, etc.).
Doesn't work properly, for the same reason the `clj` command line doesn't work properly (`rlwrap` intercepts the ANSI escape sequences emitted by this library and misinterprets them).
(println"And now something countably slow is happening...")
75
+
(let [a (atom0)]
76
+
(pd/animate! a :opts {:total1000000
77
+
:redraw-rate60; Use 60 fps for the demo
78
+
:style (:coloured-ascii-boxes pd/styles)} ; :emoji-boxes is also fun to try
79
+
(run! (fn [_] (Thread/sleep010) (swap! a inc)) (range1000000)))) ; Count up to a million, slowly
80
+
(println)
96
81
```
97
82
98
-
### API Documentation
99
-
100
-
[API documentation is available here](https://pmonks.github.io/spinner/). The [unit](https://github.com/pmonks/spinner/blob/release/test/progress/indeterminate_test.clj)[tests](https://github.com/pmonks/spinner/blob/release/test/progress/determinate_test.clj) provide comprehensive usage examples (alternative animation sets, formatting, etc.).
0 commit comments