diff --git a/src/help.rs b/src/help.rs index 4eb12a7..49ba02f 100644 --- a/src/help.rs +++ b/src/help.rs @@ -1,5 +1,3 @@ - - pub fn print_help() { let msg: String = String::from( r#"icd [Action] [flag] @@ -35,4 +33,4 @@ pub fn print_help() { ); println!("{}", msg); -} \ No newline at end of file +} diff --git a/src/main.rs b/src/main.rs index 4b6dd34..f427aa1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,52 +7,6 @@ mod syncers; mod utilities; use std::env; -// use std::process; - -/* -fn exit_program(code: i32) { - process::exit(code); -} -*/ - -/* -fn print_help() { - let msg: String = String::from( - r#"icd [Action] [flag] - - Actions - download - upload-meta - retrieve - delete - - Flags - Required for all actions - -u username - -p password - -h host - - Required for upload with metadata - -s path of song - -t track number - -m metadata filepath - -ca coverart filepath - -scma directory where songs, metadata, and cover art exists and will be uploaded (Optional) - - Required for download - -b song id - -d path to download song (Optional) - - Required for retrieving records - -rt retrieve type (songs is only accepted) - - Required for deleting a song - -D song id"#, - ); - - println!("{}", msg); -} - */ fn main() { let args: Vec = env::args().collect(); diff --git a/src/managers/user_manager.rs b/src/managers/user_manager.rs index 61607e2..16bb8f2 100644 --- a/src/managers/user_manager.rs +++ b/src/managers/user_manager.rs @@ -27,15 +27,21 @@ impl UserManager { pub fn parse_user_from_actions(&mut self) { let args = &self.ica_action.flags; + // Quit the loop when two are found + let mut amt: i32 = 0; for arg in args { let flag = &arg.flag; if flag == "-u" { self.user.username = String::from(&arg.value); + amt += 1; + } else if flag == "-p" { + self.user.password = String::from(&arg.value); + amt += 1; } - if flag == "-p" { - self.user.password = String::from(&arg.value); + if amt == 2 { + break; } } } diff --git a/src/utilities/checks.rs b/src/utilities/checks.rs index 2e67710..a880430 100644 --- a/src/utilities/checks.rs +++ b/src/utilities/checks.rs @@ -27,7 +27,6 @@ impl Checks { } } - pub fn exit_program(code: i32) { std::process::exit(code); -} \ No newline at end of file +}