Refactoring (#31)
* Refactoring code * Code formatting * More changes * Moved to icarus-models::user * Some refactoring * Updated icarus-models * Removing constants * Replaced with icarus-models constants * Formatting * Switched to constants from icarus-models: * Replaced Token with AccessToken from icarus-models * Updated icarus-models * Formatting * Removing code
This commit was merged in pull request #31.
This commit is contained in:
+8
-56
@@ -1,4 +1,4 @@
|
||||
mod constants;
|
||||
mod help;
|
||||
mod managers;
|
||||
mod models;
|
||||
mod parsers;
|
||||
@@ -6,71 +6,23 @@ 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();
|
||||
|
||||
if args.len() == 1 {
|
||||
print_help();
|
||||
exit_program(-1);
|
||||
}
|
||||
|
||||
let args_len = args.len() as i32;
|
||||
|
||||
if args_len == 1 {
|
||||
help::print_help();
|
||||
utilities::checks::exit_program(-1);
|
||||
}
|
||||
|
||||
println!("Argument count: {}", args_len);
|
||||
|
||||
let mut act_mgr = managers::action_managers::ActionManager {
|
||||
action: String::new(),
|
||||
flags: Vec::new(),
|
||||
params: args,
|
||||
param_count: args_len,
|
||||
};
|
||||
let mut act_mgr = managers::action_managers::ActionManager::default();
|
||||
act_mgr.set_params(&args);
|
||||
act_mgr.initialize();
|
||||
|
||||
let chosen_act = act_mgr.retrieve_icarus_action();
|
||||
|
||||
chosen_act.print_action_and_flags();
|
||||
|
||||
let mut cmt_mgr = managers::commit_manager::CommitManager {
|
||||
|
||||
Reference in New Issue
Block a user