Refactoring #34

Merged
kdeng00 merged 14 commits from refactoring into master 2025-03-15 20:37:04 -04:00
4 changed files with 10 additions and 53 deletions
Showing only changes of commit b52607b4e3 - Show all commits
+1 -3
View File
@@ -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
View File
@@ -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();
+8 -2
View File
@@ -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;
}
}
}
+1 -2
View File
@@ -27,7 +27,6 @@ impl Checks {
}
}
pub fn exit_program(code: i32) {
std::process::exit(code);
}
}