All Projects → pmonks → spinner

pmonks / spinner

Licence: Apache-2.0 license
Progress indicators for command line Clojure apps, including support for indeterminate and determinate tasks.

Programming Languages

clojure
4091 projects

Projects that are alternatives of or similar to spinner

php-cli-snake
Lightweight cli spinner with zero dependencies
Stars: ✭ 25 (-21.87%)
Mutual labels:  spinner, ansi
ckwin
C-Kermit for Windows - scriptable internet and serial communications with terminal emulation
Stars: ✭ 35 (+9.38%)
Mutual labels:  ansi
Spinners React
Lightweight SVG/CSS spinners for React
Stars: ✭ 254 (+693.75%)
Mutual labels:  spinner
loading
Laravel package to add loading indicator to pages while page is loading.
Stars: ✭ 38 (+18.75%)
Mutual labels:  spinner
ConsoleTools
A set of tools and "controls" for the .net Console.
Stars: ✭ 67 (+109.38%)
Mutual labels:  spinner
vue-product-spinner
🚗 A 3D product spinner for Vue.js with no dependencies
Stars: ✭ 94 (+193.75%)
Mutual labels:  spinner
Swiftui Animation
SwiftUI Animation
Stars: ✭ 233 (+628.13%)
Mutual labels:  spinner
strings-ansi
Handle ANSI escape codes in strings
Stars: ✭ 17 (-46.87%)
Mutual labels:  ansi
spinners-angular
Lightweight SVG/CSS spinners for Angular
Stars: ✭ 21 (-34.37%)
Mutual labels:  spinner
lsp spinner.nvim
neovim plugin to retrieve the name of the running LSP client(s) and display a spinner when there are wip job
Stars: ✭ 23 (-28.12%)
Mutual labels:  spinner
Indian-States-and-Cities-Android
Offline Android App to illustrate Auto Complete Indian cities and states text views
Stars: ✭ 19 (-40.62%)
Mutual labels:  spinner
respinner
Pretty and customizable svg spinners for React.js
Stars: ✭ 89 (+178.13%)
Mutual labels:  spinner
kotter
A declarative, Kotlin-idiomatic API for writing dynamic console applications.
Stars: ✭ 355 (+1009.38%)
Mutual labels:  ansi
Text Spinners
Pure text, CSS only, font independent, inline loading indicators
Stars: ✭ 2,728 (+8425%)
Mutual labels:  spinner
react-redux-spinner
An automatic spinner for react and redux
Stars: ✭ 81 (+153.13%)
Mutual labels:  spinner
Egjs View360
360 integrated viewing solution
Stars: ✭ 252 (+687.5%)
Mutual labels:  spinner
VTXEdit
VTX ANSI Editor.
Stars: ✭ 17 (-46.87%)
Mutual labels:  ansi
ZXLoadingView
🍕ZXLoadingView is an iOS progress-activity
Stars: ✭ 14 (-56.25%)
Mutual labels:  spinner
strip-ansi-stream
Strip ANSI escape codes
Stars: ✭ 32 (+0%)
Mutual labels:  ansi
django-concurrency-talk
🎭 Database Integrity in Django: Safely Handling Critical Data in Distributed Systems
Stars: ✭ 49 (+53.13%)
Mutual labels:  ansi
main CI Dependencies
dev CI Dependencies

Latest Version Open Issues License

spinner

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".

What is it useful for?

To give the user of a command line app a visual progress indicator during long running processes.

Here it is in action (from the unit tests):

Spinner example screenshot

Note that using Unicode characters in progress indicators may be unreliable, depending on your OS, terminal, font, encoding, phase of the moon, etc.

Installation

spinner is available as a Maven artifact from Clojars.

Trying it Out

Important Notes:

  1. If you're using leiningen, your REPL must be run in a trampoline (lein trampoline repl) in order for the ANSI escape sequences emitted by spinner to function.

  2. If you're using the Clojure CLI tools, you must use the clojure binary, as the clj binary wraps the JVM in rlwrap which then incorrectly interprets some of the ANSI escape sequences emitted by spinner. Some other readline alternatives (notably Rebel Readline) have been reported to work correctly.

Clojure CLI

$ clojure -Sdeps '{:deps {com.github.pmonks/spinner {:mvn/version "#.#.#"}}}'  # Where #.#.# is replaced with an actual version number (see badge above)

Leiningen

$ lein trampoline try com.github.pmonks/spinner

Simple REPL Session

Indeterminate Task (aka "spinner")
(require '[progress.indeterminate :as pi] :reload-all)

(pi/animate!
  (pi/print "A long running process...")
  (Thread/sleep 2500)   ; Simulate a long running process
  (pi/print "\nAnother long running process...")
  (Thread/sleep 2500)   ; Simulate another long running process
  (pi/print "\nAll done!\n"))  
Determinate Task (aka "progress bar")
(require '[progress.determinate :as pd] :reload-all)

(let [a (atom 0)]
  ; Add up all the numbers from 1 to 100... ...slowly
  (pd/animate!
    a
    (reduce + (map #(do (Thread/sleep 10) (swap! a inc) %) (range 100)))))

Usage

The functionality is provided by the progress.indeterminate and progress.determinate namespaces.

Require them in the REPL:

(require '[progress.indeterminate :as pi] :reload-all)
(require '[progress.determinate   :as pd] :reload-all)

Require them in your application:

(ns my-app.core
  (:require [progress.indeterminate :as pi]
            [progress.determinate   :as pd]))

API Documentation

API documentation is available here. The unit tests provide comprehensive usage examples (alternative animation sets, formatting, etc.).

Contributor Information

Contributing Guidelines

Bug Tracker

Code of Conduct

Developer Workflow

This project uses the git-flow branching strategy, with the caveat that the permanent branches are called main and dev, and any changes to the main branch are considered a release and auto-deployed (JARs to Clojars, API docs to GitHub Pages, etc.).

For this reason, all development must occur either in branch dev, or (preferably) in temporary branches off of dev. All PRs from forked repos must also be submitted against dev; the main branch is only updated from dev via PRs created by the core development team. All other changes submitted to main will be rejected.

Build Tasks

spinner uses tools.build. You can get a list of available tasks by running:

clojure -A:deps -T:build help/doc

Of particular interest are:

  • clojure -T:build test - run the unit tests
  • clojure -T:build lint - run the linters (clj-kondo and eastwood)
  • clojure -T:build ci - run the full CI suite (check for outdated dependencies, run the unit tests, run the linters)
  • clojure -T:build install - build the JAR and install it locally (e.g. so you can test it with downstream code)

Please note that the deploy task is restricted to the core development team (and will not function if you run it yourself).

Why are there so many different groupIds on Clojars for this project?

The project was originally developed under my personal GitHub account. In early 2018 it was transferred to the clj-commons GitHub organisation, but then, as that group refined their scope and mission, it was determined that it no longer belonged there, and the project were transferred back in late 2021. During this time the build tooling for the project also changed from Leiningen to tools.build, which created further groupId churn (tools.build introduced special, useful semantics for com.github.username groupIds that don't exist with Leiningen or Clojars).

Why is it called "spinner", when it offers more than just spinners?

tl;dr - historical reasons and naming is hard.

The library started life providing a single hardcoded animation sequence (the classic "/-\|" sequence), and then organically grew from there. Because the name "spinner" appears in various places where changing it would break things (the GitHub repo, Maven artifact ids, etc.), I decided to stick with the name even though it's no longer very accurate.

License

Copyright © 2014 Peter Monks

Distributed under the Apache License, Version 2.0.

SPDX-License-Identifier: Apache-2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].