Refactoring #31
+1
-3
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
-46
@@ -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<String> = env::args().collect();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ impl Checks {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub fn exit_program(code: i32) {
|
||||
std::process::exit(code);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user