feat: Add clap and parse script parameter
This commit is contained in:
parent
fce9dcc6fe
commit
da82ece1ca
3 changed files with 258 additions and 3 deletions
21
src/main.rs
21
src/main.rs
|
|
@ -1,3 +1,20 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
use clap::Parser;
|
||||
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(version, about, long_about = None)]
|
||||
struct Args {
|
||||
/// Script to run
|
||||
#[arg(short, long)]
|
||||
script: Option<String>,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = Args::parse();
|
||||
|
||||
if let Some(script) = args.script {
|
||||
println!("Run script! {}", script);
|
||||
} else {
|
||||
println!("Run Prompt");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue