caprice is a work in progress REPL for Rust projects featuring an easy to use, zsh like autocomplete feature.

using caprice with the spinning square example from Piston

Usage

caprice uses crossterm as its terminal emulator.

Example:

```rust use caprice::{Caprice, CapriceCommand}; use std::thread; use std::time::Duration; fn main() { let mut caprice = Caprice::new() .setprompt("!:") // set the prompt .disablectrlc() // pressing control + c won't close the caprice console .setkeywords(&[ // set some tokens "sometoken".toowned(), "someothertoken".toowned(), "exit".toowned(), // an exit keyword ]) .init(); // initialises the caprice terminal // caprice.run() will run the caprice in a separate thread. // you can use the returned tx and rx channels for receiving and sending messages // to caprice instance let (tx, rx, capricehandle) = caprice.run().unwrap(); // our main application runs here // for this example we will simply print back // the tokens send by caprice loop { // if we received a token from caprice if let Ok(token) = rx.tryrecv() { match token.asstr() { // leave if the user types exit "exit" => { tx.send(CapriceCommand::Println("bye".toowned())).unwrap(); tx.send(CapriceCommand::Exit).unwrap(); capricehandle.join().expect("couldn't join thread").expect("Caprice run has encountered an error"); break; // at this point caprice has already exited, let the main process do as well }, // else send back the token to be printed _ => { let printtoken = format!("Got {} from Caprice", token); tx.send(CapriceCommand::Println(printtoken)).unwrap(); } } } // let the thread sleep for some time thread::sleep(Duration::frommillis(10)); } }

```

Releases

Release info and changelogs can be found here