init
This commit is contained in:
35
src/cli.rs
Normal file
35
src/cli.rs
Normal file
@ -0,0 +1,35 @@
|
||||
use clap::Parser;
|
||||
|
||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(about, long_about = None)]
|
||||
pub struct Cli {
|
||||
#[arg(short, long)]
|
||||
pub version: bool,
|
||||
///Extra output mode, primarily used for debugging
|
||||
#[arg(long)]
|
||||
pub verbose: bool,
|
||||
///Download and install plugin(s)
|
||||
#[arg(long)]
|
||||
pub add_plugins: Vec<String>,
|
||||
//Remove plugin(s)
|
||||
#[arg(long)]
|
||||
pub remove_plugins: Vec<String>,
|
||||
///Start the shell with no rc configurations
|
||||
#[arg(long)]
|
||||
pub norc: bool,
|
||||
///Disable the Luau JIT backend
|
||||
#[arg(long)]
|
||||
pub nojit: bool,
|
||||
}
|
||||
|
||||
pub fn parser() -> Option<Cli> {
|
||||
let cli_parser = Cli::parse();
|
||||
if cli_parser.version {
|
||||
println!("Lambda Shell, version: {}.", VERSION);
|
||||
println!("liblambdashell, version: {}.", liblambdashell::VERSION);
|
||||
return None //stop here
|
||||
}
|
||||
Some(cli_parser)
|
||||
}
|
13
src/main.rs
Normal file
13
src/main.rs
Normal file
@ -0,0 +1,13 @@
|
||||
use liblambdashell::shell;
|
||||
|
||||
mod cli;
|
||||
|
||||
fn main() {
|
||||
if let Some(args) = cli::parser() {
|
||||
let shell_config = shell::Config {
|
||||
norc: args.norc,
|
||||
};
|
||||
let mut shell_instance = shell::LambdaShell::create(shell_config);
|
||||
shell_instance.start();
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user