minor cleaning
This commit is contained in:
@@ -7,7 +7,7 @@ use crate::services::list_folders::ListFolders;
|
||||
use crate::services::download_files::DownloadFiles;
|
||||
use crate::store::object;
|
||||
use crate::commands;
|
||||
use crate::utils::api::{get_local_path_t, ApiProps};
|
||||
use crate::utils::api::ApiProps;
|
||||
use crate::global::global::{DIR_PATH, set_dir_path};
|
||||
|
||||
pub fn clone(remote: Values<'_>) {
|
||||
@@ -27,7 +27,6 @@ pub fn clone(remote: Values<'_>) {
|
||||
username: username.to_string(),
|
||||
root: dist_path_str.to_string(),
|
||||
};
|
||||
dbg!(dist_path_str.clone());
|
||||
|
||||
let ref_path = match d.clone() {
|
||||
Some(dir) => Path::new(&dir).to_owned(),
|
||||
@@ -49,7 +48,6 @@ pub fn clone(remote: Values<'_>) {
|
||||
// request folder content
|
||||
let mut objs = vec![];
|
||||
tokio::runtime::Runtime::new().unwrap().block_on(async {
|
||||
dbg!(folder.clone());
|
||||
let res = ListFolders::new()
|
||||
.set_request(folder.as_str(), &api_props)
|
||||
.gethref()
|
||||
@@ -100,7 +98,6 @@ pub fn clone(remote: Values<'_>) {
|
||||
let mut iter = objs.iter();
|
||||
iter.next(); // jump first element which is the folder cloned
|
||||
for object in iter {
|
||||
dbg!(object.clone());
|
||||
if object.href.clone().unwrap().chars().last().unwrap() == '/' {
|
||||
folders.push(object.relative_s.clone().unwrap().to_string());
|
||||
} else {
|
||||
|
||||
@@ -40,7 +40,6 @@ pub fn get(var: &str) -> Option<String> {
|
||||
if let Ok(lines) = read::read_lines(root) {
|
||||
for line in lines {
|
||||
if let Ok(l) = line {
|
||||
dbg!(l.clone());
|
||||
if l.starts_with(var.clone()) {
|
||||
let (_, val) = l.split_once(" ").unwrap();
|
||||
return Some(val.to_owned());
|
||||
|
||||
@@ -202,39 +202,3 @@ impl PushFactory {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn can_push_file(obj: Obj) -> PushState {
|
||||
dbg!(obj.clone());
|
||||
// check if exist on server
|
||||
let file_infos = tokio::runtime::Runtime::new().unwrap().block_on(async {
|
||||
let res = ReqProps::new()
|
||||
.set_url(obj.path.to_str().unwrap())
|
||||
.getlastmodified()
|
||||
.send_with_err()
|
||||
.await;
|
||||
|
||||
match res {
|
||||
Ok(data) => Ok(data),
|
||||
Err(ApiError::IncorrectRequest(err)) => {
|
||||
if err.status() == 404 {
|
||||
Ok(vec![])
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
},
|
||||
Err(_) => Err(()),
|
||||
}
|
||||
});
|
||||
|
||||
if let Ok(infos) = file_infos {
|
||||
if infos.len() == 0 {
|
||||
// file doesn't exist on remote
|
||||
PushState::Valid
|
||||
} else {
|
||||
// check date
|
||||
PushState::Conflict
|
||||
}
|
||||
} else {
|
||||
PushState::Error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,10 +58,9 @@ pub fn get_all_staged() -> Vec<Obj> {
|
||||
staged_objs
|
||||
}
|
||||
|
||||
fn get_renamed(new_obj: &mut Vec<Obj>, del_obj: &mut Vec<Obj>) -> Vec<Obj> {
|
||||
fn get_renamed(_new_obj: &mut Vec<Obj>, _del_obj: &mut Vec<Obj>) -> Vec<Obj> {
|
||||
// get hash of all new obj, compare to hash of all del
|
||||
let renamed_objs = vec![];
|
||||
|
||||
renamed_objs
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user