Parse cli args
This commit is contained in:
parent
5e04129f4d
commit
b29f22a5a8
3 changed files with 951 additions and 2 deletions
27
src/main.rs
27
src/main.rs
|
|
@ -1,3 +1,26 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
use std::path::PathBuf;
|
||||
|
||||
use clap::Parser;
|
||||
|
||||
#[derive(Debug, clap::Parser)]
|
||||
struct BwCmd {}
|
||||
|
||||
#[derive(Debug, clap::Parser)]
|
||||
enum Cmd {
|
||||
Bw(BwCmd),
|
||||
}
|
||||
|
||||
#[derive(Debug, clap::Parser)]
|
||||
struct Args {
|
||||
#[arg(long, short)]
|
||||
r#in: Option<PathBuf>,
|
||||
#[arg(long, short)]
|
||||
out: Option<PathBuf>,
|
||||
#[command(subcommand)]
|
||||
cmd: Cmd,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = Args::parse();
|
||||
println!("{args:#?}");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue