All Projects → kiliankoe → Clispinner

kiliankoe / Clispinner

Licence: mit
Swifty Terminal Spinner

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Clispinner

Elixir cli spinners
Spinnig Animations for Command Line Applications
Stars: ✭ 117 (-40.61%)
Mutual labels:  cli, spinner, loading-animations
Epic Spinners
Easy to use css spinners collection with Vue.js integration
Stars: ✭ 3,548 (+1701.02%)
Mutual labels:  spinner, loading-animations
Progress bar
Command-line progress bars and spinners for Elixir.
Stars: ✭ 281 (+42.64%)
Mutual labels:  cli, spinner
Spinners
A Sass mixin to generate fully customizable, pure CSS3 loading/busy indicators
Stars: ✭ 33 (-83.25%)
Mutual labels:  spinner, loading-animations
loading
Laravel package to add loading indicator to pages while page is loading.
Stars: ✭ 38 (-80.71%)
Mutual labels:  spinner, loading-animations
react-native-spinner-button
React Native button component with multiple animated spinners
Stars: ✭ 105 (-46.7%)
Mutual labels:  spinner, loading-animations
Whirl
CSS loading animations with minimal effort!
Stars: ✭ 774 (+292.89%)
Mutual labels:  spinner, loading-animations
Yaspin
A lightweight terminal spinner for Python with safe pipes and redirects 🎁
Stars: ✭ 413 (+109.64%)
Mutual labels:  cli, spinner
Fliplog
fluent logging with verbose insight, colors, tables, emoji, filtering, spinners, progress bars, timestamps, capturing, stack traces, tracking, presets, & more...
Stars: ✭ 41 (-79.19%)
Mutual labels:  cli, spinner
Mpb
multi progress bar for Go cli applications
Stars: ✭ 1,221 (+519.8%)
Mutual labels:  cli, spinner
Spinner
Go (golang) package with 90 configurable terminal spinner/progress indicators.
Stars: ✭ 1,637 (+730.96%)
Mutual labels:  cli, spinner
respinner
Pretty and customizable svg spinners for React.js
Stars: ✭ 89 (-54.82%)
Mutual labels:  spinner, loading-animations
Php Console Spinner
Colorful highly configurable spinner for php cli applications (suitable for async apps)
Stars: ✭ 225 (+14.21%)
Mutual labels:  cli, spinner
React Epic Spinners
Reusable react components for epic-spinners
Stars: ✭ 280 (+42.13%)
Mutual labels:  spinner, loading-animations
Text Spinners
Pure text, CSS only, font independent, inline loading indicators
Stars: ✭ 2,728 (+1284.77%)
Mutual labels:  spinner, loading-animations
Spinnercpp
Simple header only library to add a spinner / progress indicator to any terminal application.
Stars: ✭ 37 (-81.22%)
Mutual labels:  cli, spinner
Yacspin
Yet Another CLi Spinner; providing over 70 easy to use and customizable terminal spinners for multiple OSes
Stars: ✭ 139 (-29.44%)
Mutual labels:  cli, spinner
Alive Progress
A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
Stars: ✭ 2,940 (+1392.39%)
Mutual labels:  cli, spinner
Pipes Rs
An over-engineered rewrite of pipes.sh in Rust
Stars: ✭ 189 (-4.06%)
Mutual labels:  cli
Ng Tailwindcss
A CLI tool for integrating Tailwind CSS into Angular-CLI projects
Stars: ✭ 194 (-1.52%)
Mutual labels:  cli

CLISpinner

Travis

60+ spinners for use in the terminal

Shamelessly ripped off from sindresorhus/cli-spinners.

Install

.package(url: "https://github.com/kiliankoe/CLISpinner", from: "see latest release")

Usage

Just want to display a simple spinner for two seconds?

let s = Spinner(pattern: .dots)
s.start()
sleep(2)
s.stop()

Want some changing text and patterns?

let s = Spinner(pattern: .dots, text: "Foobar...", color: .lightCyan)
s.start()
sleep(2)
s.succeed(text: "Barfoo")
// will change the displayed text to '✔ Barfoo'

Made your own custom pattern?

let pattern = try Pattern.load(from: "/path/to/your/pattern.json")
let s = spinner(pattern: pattern)
s.start()
sleep(2)
s.stop()

Want all the patterns from sindresorhus/cli-spinners?

let patterns = try Patterns(from: "/path/to/spinners.json")
let s = spinner(pattern: patterns["christmas"]!)
s.start()
sleep(2)
s.stop()

That's basically it 👌

Creating your own Pattern

The Pattern type can read in patterns from a JSON file using the following format:

{
    "frames": [
        "1",
        "2",
        "3",
        "4",
        "5"
    ],
    "speed": 0.08
}

To keep multiple patterns in a single file:

{
    "pattern-name1": {
        "frames": [
            "<(**<)",
            "<(**)>",
            "(>**)>"
        ],
        "speed": 0.01
    },
    "pattern-name2": {
        "frames": [
            "1",
            "2",
            "3",
            "2"
        ],
        "speed": 0.12
    }
}

Caveat

To look nice the spinner hides the user's cursor as long as it's running and displays it again when stopped. The issue with this is that the cursor will still be hidden if the user interrupts the process (by sending a SIGINT through ctrl+c for example). The best way to handle this is by setting up a signal handler in your code and calling spinner.unhideCursor() on exiting. This library purposefully does not do that for you so as not to interfere with any possible signal handlers you might already have set up.

See IBM-Swift/BlueSignals for a clean and safe way of handling signals. The appropriate signal handler for your project could look something like this.

import Signals

let spinner = Spinner(pattern: .dots)
// ...

Signals.trap(signal: .int) { _ in
    spinner.unhideCursor()
    exit(0)
}

Used by

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