#prompt #console #cli #terminal #command-line #npm-package #themes

cliclack

Beautiful, minimal, opinionated CLI prompts inspired by the Clack NPM package

19 releases

0.2.5 Apr 11, 2024
0.1.14 Apr 4, 2024
0.1.13 Feb 27, 2024
0.1.10 Dec 20, 2023
0.1.6 Jul 23, 2023

#68 in Command-line interface

Download history 180/week @ 2024-01-05 507/week @ 2024-01-12 467/week @ 2024-01-19 469/week @ 2024-01-26 398/week @ 2024-02-02 567/week @ 2024-02-09 1586/week @ 2024-02-16 857/week @ 2024-02-23 3194/week @ 2024-03-01 2281/week @ 2024-03-08 699/week @ 2024-03-15 513/week @ 2024-03-22 1095/week @ 2024-03-29 1086/week @ 2024-04-05 946/week @ 2024-04-12 955/week @ 2024-04-19

4,153 downloads per month
Used in 8 crates

MIT license

250KB
1.5K SLoC

CliClack Logo

Effortlessly build beautiful command-line apps with Rust 🦀✨

github.com crates.io docs.rs license

Beautiful, minimal, opinionated CLI prompts inspired by the @clack/prompts npm package.

cargo add cliclack

cliclack in action

cargo run --example basic
cargo run --example log
CliClack Example

💎 Fancy minimal UI
✅ Simple API
🎨 Theme support

Setup

The intro and outro/outro_cancel functions will print a message to begin and end a prompt session respectively.

use cliclack::{intro, outro};

intro("create-my-app")?;
// Do stuff
outro("You're all set!")?;

Input

The input prompt accepts a single line of text trying to parse it into a target type.

use cliclack::input;

let path: String = input("Where should we create your project?")
    .placeholder("./sparkling-solid")
    .validate(|input: &String| {
        if input.is_empty() {
            Err("Please enter a path.")
        } else if !input.starts_with("./") {
            Err("Please enter a relative path")
        } else {
            Ok(())
        }
    })
    .interact()?;

🎨 Theme

A custom theme can be applied for UI rendering. An example of theme customization:

cargo run --example theme
CliClack Magenta Theme

🚥 Progress Bar

Starting from cliclack = "0.2.3", progress bars and multi-progress bars are supported.

CliClack Multi Progress Bar

See more

Dependencies

~1.9–9.5MB
~87K SLoC