Add flags
This commit is contained in:
		
							parent
							
								
									1bd216c50b
								
							
						
					
					
						commit
						861001a2e1
					
				
							
								
								
									
										13
									
								
								src/main.rs
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/main.rs
									
									
									
									
									
								
							@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					use clap::{App, Arg};
 | 
				
			||||||
use std::fs;
 | 
					use std::fs;
 | 
				
			||||||
use std::io;
 | 
					use std::io;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -111,6 +112,18 @@ fn open_file(filename: &str) -> io::Result<String> {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
 | 
					fn main() -> Result<(), Box<dyn std::error::Error>> {
 | 
				
			||||||
 | 
					    let matches = App::new("DancingDroids")
 | 
				
			||||||
 | 
					        .version("0.1.0")
 | 
				
			||||||
 | 
					        .about("When droids dance togethers")
 | 
				
			||||||
 | 
					        .arg(
 | 
				
			||||||
 | 
					            Arg::with_name("file")
 | 
				
			||||||
 | 
					                .short("f")
 | 
				
			||||||
 | 
					                .long("file")
 | 
				
			||||||
 | 
					                .takes_value(true)
 | 
				
			||||||
 | 
					                .help("Configuration file"),
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					        .get_matches();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let mut robot_pool: Vec<Robot> = Vec::new();
 | 
					    let mut robot_pool: Vec<Robot> = Vec::new();
 | 
				
			||||||
    let raw_conf = open_file("two_robots.txt")?;
 | 
					    let raw_conf = open_file("two_robots.txt")?;
 | 
				
			||||||
    Ok(())
 | 
					    Ok(())
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user