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

cliclack

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

25 releases

0.3.5 Sep 12, 2024
0.3.2 Jul 8, 2024
0.1.13 Feb 27, 2024
0.1.10 Dec 20, 2023
0.1.6 Jul 23, 2023

#44 in Command-line interface

Download history 2081/week @ 2024-08-22 2172/week @ 2024-08-29 2507/week @ 2024-09-05 4283/week @ 2024-09-12 3754/week @ 2024-09-19 3887/week @ 2024-09-26 5483/week @ 2024-10-03 6593/week @ 2024-10-10 5548/week @ 2024-10-17 5043/week @ 2024-10-24 5253/week @ 2024-10-31 5163/week @ 2024-11-07 4971/week @ 2024-11-14 4007/week @ 2024-11-21 4477/week @ 2024-11-28 3371/week @ 2024-12-05

17,688 downloads per month
Used in 24 crates (23 directly)

MIT license

255KB
2K 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. Multiline input can be enabled using the multiline() switch.

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

~3–10MB
~106K SLoC