mdaffin / slaps

Interactive CLI for your Rust command-line applications using your existing Clap config

Home Page:https://crates.io/crates/slaps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crates.io Documentation GitHub Workflow Status Coveralls github

Slaps adds an interactive CLI mode to your Rust command-line applications using your existing Clap configuration.

It combines Clap with rustyline to provide line editing, auto-completion and syntax highlighting.

Example

This:

use slaps::Slaps;

// Using structopt
Slaps::with_name("slaps")
    .command(RekeyCommand::clap(), |args| Ok(()))
    .command(AccountCommand::clap(), |args| Ok(()))
    .command(UndoCommand::clap(), |args| Ok(()))
    .run()?;

Gets you this:

Terminal screenshot

Zero extra configuration needed.

Notes

This project is currently in early stages of development and any changes are motivated by it being part of my personal toolkit to quickly build Rust command-line applications. Most of it was extracted wholesale from the first project I built while learning Rust. It abuses the hell out of Clap's doc(hidden) internals to minimise the overhead of the glue code holding everything together. This makes things likely to break with future versions of Clap. You have been warned, your warranty is now void, etc.

About

Interactive CLI for your Rust command-line applications using your existing Clap config

https://crates.io/crates/slaps

License:Do What The F*ck You Want To Public License


Languages

Language:Rust 100.0%