feat: finish Argument Parsing
This commit is contained in:
		
							
								
								
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -14,3 +14,8 @@ Cargo.lock
 | 
			
		||||
# MSVC Windows builds of rustc generate these, which store debugging information
 | 
			
		||||
*.pdb
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Added by cargo
 | 
			
		||||
 | 
			
		||||
/target
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								Cargo.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Cargo.toml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
[package]
 | 
			
		||||
name = "rget"
 | 
			
		||||
version = "0.1.0"
 | 
			
		||||
edition = "2021"
 | 
			
		||||
authors = ["Smart SangGe <liangjunyong06@gmail.com>"]
 | 
			
		||||
 | 
			
		||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 | 
			
		||||
 | 
			
		||||
[dependencies]
 | 
			
		||||
clap = "2.26.0"
 | 
			
		||||
							
								
								
									
										18
									
								
								src/main.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/main.rs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
extern crate clap;
 | 
			
		||||
 | 
			
		||||
use clap::{Arg, App};
 | 
			
		||||
 | 
			
		||||
fn main() {
 | 
			
		||||
    let matches = App::new("Rget")
 | 
			
		||||
        .version("0.1.0")
 | 
			
		||||
        .author("Smart SangGe <liangjunyong06@gmail.com>")
 | 
			
		||||
        .about("wget clone written in Rust")
 | 
			
		||||
        .arg(Arg::with_name("URL")
 | 
			
		||||
                 .required(true)
 | 
			
		||||
                 .takes_value(true)
 | 
			
		||||
                 .index(1)
 | 
			
		||||
                 .help("url to download"))
 | 
			
		||||
        .get_matches();
 | 
			
		||||
    let url = matches.value_of("URL").unwrap();
 | 
			
		||||
    println!("{}", url);
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user