mirror of
https://github.com/house-of-vanity/v2-uri-parser.git
synced 2025-12-16 15:07:53 +00:00
Add clap for parsing cli args
This commit is contained in:
26
src/main.rs
26
src/main.rs
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user