Skip to content

Techassi/rupl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rupl

A highly customizable REPL framework for Rust.

Usage

use rupl::{Arg, Command, FnContext, Repl, ReplResult};

fn main() -> ReplResult<()> {
    let mut repl = Repl::new(());

    repl.with_prompt(">>")
        .with_version("1.0.1-rc2")
        .with_welcome_message("This basic REPL says 'Hello, world!'")
        .with_exit_message("Exiting... Bye!")
        .with_builtins(true)
        .ignore_empty_line(true)
        .with_output_prompt(Some(":> "))
        .with_command(
            Command::new("hello", hello)
                .with_arg(Arg::new("name"))
                .with_arg(Arg::new("end")),
        );

    repl.run()
}

fn hello(ctx: FnContext<()>) -> ReplResult<Option<String>> {
    let name: String = ctx.args().get("name")?;
    let end: String = ctx.args().get("end")?;

    Ok(Some(format!("Hello, {}{}", name, end)))
}

About

A highly customizable REPL framework for Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages