slaps

Crates.ioslaps
lib.rsslaps
version0.2.3
sourcesrc
created_at2020-07-25 17:17:18.322058
updated_at2020-07-27 10:11:24.782324
descriptionInteractive shell interface using your existing Clap/StructOpt config
homepage
repositoryhttps://github.com/tjg1/slaps
max_upload_size
id269529
size137,708
rd (tjg1)

documentation

README

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.

Commit count: 0

cargo fmt