Add clap for parsing cli args

This commit is contained in:
Keivan-sf
2023-10-24 17:00:00 +03:30
parent c75ff2ad09
commit 19a825c049
3 changed files with 203 additions and 3 deletions

View File

@@ -1,7 +1,27 @@
mod parser;
use clap::{Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser)]
#[command(author, version, about, long_about = None)]
struct Cli {
uri: String,
#[arg(short, long, value_name = "socksport")]
socksport: Option<u16>,
}
fn main() {
let args: Vec<String> = std::env::args().collect();
let uri = args.get(1).unwrap();
parser::parse(uri);
let cli = Cli::parse();
match cli.socksport {
Some(port) => {
println!("the port: {}", port)
}
None => {
println!("the port is not here")
}
};
println!("the uri is: {}", cli.uri);
// let args: Vec<String> = std::env::args().collect();
// let uri = args.get(1).unwrap();
// parser::parse(uri);
}