More changes
This commit is contained in:
+8
-5
@@ -1,5 +1,8 @@
|
|||||||
mod managers;
|
mod managers;
|
||||||
mod models;
|
mod models;
|
||||||
|
mod utilities;
|
||||||
|
mod parsers;
|
||||||
|
mod syncers;
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::process;
|
use std::process;
|
||||||
@@ -75,12 +78,12 @@ fn main() {
|
|||||||
chosen_act.print_action_and_flags();
|
chosen_act.print_action_and_flags();
|
||||||
|
|
||||||
let cmt_mgr = managers::commit_manager::CommitManager {
|
let cmt_mgr = managers::commit_manager::CommitManager {
|
||||||
action: String::from(""),
|
// action: String::from(""),
|
||||||
flags: Vec::new(),
|
// flags: Vec::new(),
|
||||||
params: Vec::new(),
|
// params: Vec::new(),
|
||||||
param_count: 1,
|
// param_count: 1,
|
||||||
ica_action: chosen_act,
|
ica_action: chosen_act,
|
||||||
};
|
};
|
||||||
|
|
||||||
// cmt_mgr.commit_action();
|
cmt_mgr.commit_action();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,15 +3,14 @@ use std::collections::HashMap;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::models;
|
use crate::models;
|
||||||
|
use crate::utilities;
|
||||||
// mod managers {
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct CommitManager {
|
pub struct CommitManager {
|
||||||
pub action: String,
|
// pub action: String,
|
||||||
pub flags: Vec<models::flags::Flags>,
|
// pub flags: Vec<models::flags::Flags>,
|
||||||
pub params: Vec<String>,
|
// pub params: Vec<String>,
|
||||||
pub param_count: i32,
|
// pub param_count: i32,
|
||||||
pub ica_action: models::icarus_action::IcarusAction,
|
pub ica_action: models::icarus_action::IcarusAction,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,4 +90,3 @@ impl CommitManager {
|
|||||||
return String::from("");
|
return String::from("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ use std::default::Default;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct API {
|
pub struct API {
|
||||||
pub url: String,
|
pub url: String,
|
||||||
pub endpoint: String,
|
pub endpoint: String,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use crate::models;
|
use crate::models;
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct IcarusAction {
|
pub struct IcarusAction {
|
||||||
pub action: String,
|
pub action: String,
|
||||||
pub flags: Vec<models::flags::Flags>,
|
pub flags: Vec<models::flags::Flags>,
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ impl Song {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn song_path(&self) -> String {
|
pub fn song_path(&self) -> String {
|
||||||
// let directory = &self.directory.unwrap();
|
|
||||||
let directory = &<std::option::Option<std::string::String> as Clone>::clone(&self.directory).unwrap();
|
let directory = &<std::option::Option<std::string::String> as Clone>::clone(&self.directory).unwrap();
|
||||||
|
|
||||||
let mut buffer: String = directory.to_string();
|
let mut buffer: String = directory.to_string();
|
||||||
@@ -77,13 +76,11 @@ impl Song {
|
|||||||
filename += ".wav";
|
filename += ".wav";
|
||||||
}
|
}
|
||||||
|
|
||||||
// &mut self.filepath = Some(filename);
|
|
||||||
self.filepath = Some(filename);
|
self.filepath = Some(filename);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement
|
|
||||||
pub fn to_metadata_json(&self) -> Result<String, serde_json::Error> {
|
pub fn to_metadata_json(&self) -> Result<String, serde_json::Error> {
|
||||||
return serde_json::to_string_pretty(&self);
|
return serde_json::to_string_pretty(&self);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
use crate::models;
|
use crate::models;
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct APIParser {
|
pub struct APIParser {
|
||||||
pub api: models::api::API,
|
pub api: models::api::API,
|
||||||
pub ica_act: models::icarus_action::IcarusAction,
|
pub ica_act: models::icarus_action::IcarusAction,
|
||||||
@@ -8,27 +9,31 @@ pub struct APIParser {
|
|||||||
|
|
||||||
impl APIParser {
|
impl APIParser {
|
||||||
pub fn retrieve_api(&self) -> models::api::API {
|
pub fn retrieve_api(&self) -> models::api::API {
|
||||||
return self.api;
|
return self.api.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_api(&self) {
|
pub fn parse_api(&mut self) {
|
||||||
let flags = self.ica_act.flags;
|
let flags = self.ica_act.flags.clone();
|
||||||
println!("Parsing api");
|
println!("Parsing api");
|
||||||
|
|
||||||
for (i, elem) in flags {
|
let mut i = 0;
|
||||||
|
// for (i, elem) in flags {
|
||||||
|
for elem in flags {
|
||||||
let arg = elem.flag;
|
let arg = elem.flag;
|
||||||
let value = elem.value;
|
let value = elem.value;
|
||||||
|
|
||||||
if arg == "-h" {
|
if arg == "-h" {
|
||||||
if value.chars().nth((value.len() - 1)) == '/' {
|
if value.chars().nth((value.len() - 1)) == Some('/') {
|
||||||
self.api.url = value;
|
self.api.url = value;
|
||||||
} else {
|
} else {
|
||||||
self.api.url = value + "/";
|
self.api.url = value + "/";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.api.version = "v1";
|
self.api.version = "v1".to_string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,8 +5,8 @@ pub struct Checks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Checks {
|
impl Checks {
|
||||||
pub fn is_number(val: &String) -> bool {
|
pub fn is_numeric(text: &String) -> bool {
|
||||||
return val.is_numeric();
|
text.parse::<f64>().is_ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
|
|||||||
@@ -8,15 +8,15 @@ pub struct Conversions {
|
|||||||
impl Conversions {
|
impl Conversions {
|
||||||
pub fn to_lower_char(val: &mut char) {
|
pub fn to_lower_char(val: &mut char) {
|
||||||
if val.is_alphabetic() {
|
if val.is_alphabetic() {
|
||||||
val = val.to_lowercase();
|
*val = val.to_lowercase().next().unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn initialize_values(&self) {
|
pub fn initialize_values(&self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn print_value<T>(&self, val: T) {
|
pub fn print_value<T: std::fmt::Debug>(&self, val: T) {
|
||||||
println!("Going to print value");
|
println!("Going to print value");
|
||||||
println!("{}", val);
|
println!("{:?}", val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user