cleaning imports and warnings
This commit is contained in:
parent
ea2b0772af
commit
b16058b4d3
@ -1,6 +1,6 @@
|
||||
use clap::Values;
|
||||
use crate::utils::{self};
|
||||
use crate::utils::nextsyncignore::{self, ignore_file, ignore_files};
|
||||
use crate::utils::nextsyncignore::{self, ignore_file};
|
||||
use crate::store;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::io::Write;
|
||||
|
@ -1,13 +1,9 @@
|
||||
use std::fs::OpenOptions;
|
||||
use std::fs::DirBuilder;
|
||||
use std::io::prelude::*;
|
||||
use std::io::{self, Cursor};
|
||||
use std::path::{Path, PathBuf};
|
||||
use clap::Values;
|
||||
use regex::Regex;
|
||||
use xml::reader::{EventReader, XmlEvent};
|
||||
use crate::services::api::ApiError;
|
||||
use crate::services::list_folders::{ListFolders, FolderContent};
|
||||
use crate::services::list_folders::ListFolders;
|
||||
use crate::services::download_files::DownloadFiles;
|
||||
use crate::store::object;
|
||||
use crate::commands;
|
||||
@ -24,7 +20,6 @@ pub fn clone(remote: Values<'_>) {
|
||||
None => {
|
||||
eprintln!("No username found");
|
||||
todo!();
|
||||
""
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -106,7 +106,7 @@ fn main() {
|
||||
if let Some(remote) = matches.values_of("remote") {
|
||||
commands::clone::clone(remote);
|
||||
}
|
||||
} else if let Some(matches) = matches.subcommand_matches("push") {
|
||||
} else if let Some(_matches) = matches.subcommand_matches("push") {
|
||||
commands::push::push();
|
||||
} else if let Some(matches) = matches.subcommand_matches("config") {
|
||||
if let Some(mut var) = matches.values_of("variable") {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::services::api::{ApiBuilder, ApiError};
|
||||
use std::path::PathBuf;
|
||||
use reqwest::{Method, IntoUrl, Response, Error};
|
||||
use reqwest::{Method, Response, Error};
|
||||
use crate::utils::api::get_local_path_t;
|
||||
use std::fs::OpenOptions;
|
||||
use std::io::{self, Write};
|
||||
@ -28,7 +28,7 @@ impl DownloadFiles {
|
||||
self.api_builder.send().await
|
||||
}
|
||||
|
||||
pub async fn send_with_err(mut self) -> Result<Vec<u8>, ApiError> {
|
||||
pub async fn _send_with_err(mut self) -> Result<Vec<u8>, ApiError> {
|
||||
let res = self.send().await.map_err(ApiError::RequestError)?;
|
||||
if res.status().is_success() {
|
||||
let body = res.bytes().await.map_err(ApiError::EmptyError)?;
|
||||
|
@ -35,25 +35,25 @@ impl ReqProps {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn getcontenttype(&mut self) -> &mut ReqProps {
|
||||
pub fn _getcontenttype(&mut self) -> &mut ReqProps {
|
||||
self.xml_list.push(String::from("getcontenttype"));
|
||||
self.xml_payload.push_str(r#"<d:getcontenttype/>"#);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn getpermissions(&mut self) -> &mut ReqProps {
|
||||
pub fn _getpermissions(&mut self) -> &mut ReqProps {
|
||||
self.xml_list.push(String::from("permissions"));
|
||||
self.xml_payload.push_str(r#"<oc:permissions/>"#);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn getressourcetype(&mut self) -> &mut ReqProps {
|
||||
pub fn _getressourcetype(&mut self) -> &mut ReqProps {
|
||||
self.xml_list.push(String::from("resourcetype"));
|
||||
self.xml_payload.push_str(r#"<d:resourcetype/>"#);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn getetag(&mut self) -> &mut ReqProps {
|
||||
pub fn _getetag(&mut self) -> &mut ReqProps {
|
||||
self.xml_list.push(String::from("getetag"));
|
||||
self.xml_payload.push_str(r#"<d:getetag/>"#);
|
||||
self
|
||||
|
@ -57,7 +57,7 @@ pub fn add_tree(path: &Path) -> io::Result<()> {
|
||||
}
|
||||
|
||||
pub fn rm_blob(path: &Path) -> io::Result<()> {
|
||||
let (line, hash, name) = parse_path(path.clone(), true);
|
||||
let (line, hash, _) = parse_path(path.clone(), true);
|
||||
|
||||
// remove blob reference to parent
|
||||
if path.iter().count() == 1 {
|
||||
@ -111,7 +111,7 @@ fn hash_obj(obj: &str) -> (String, String) {
|
||||
(String::from(dir), String::from(res))
|
||||
}
|
||||
|
||||
fn object_path(obj: &str) -> PathBuf {
|
||||
fn _object_path(obj: &str) -> PathBuf {
|
||||
let mut root = match path::objects() {
|
||||
Some(path) => path,
|
||||
None => todo!(),
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::utils::path;
|
||||
use regex::Regex;
|
||||
use std::fs::File;
|
||||
use std::io::{Cursor, BufReader, BufRead};
|
||||
use std::io::{BufReader, BufRead};
|
||||
|
||||
pub fn read_lines() -> Result<Vec<String>, ()> {
|
||||
if let Some(path) = path::nextsyncignore() {
|
||||
@ -23,12 +23,10 @@ pub fn read_lines() -> Result<Vec<String>, ()> {
|
||||
Ok(vec![])
|
||||
}
|
||||
|
||||
pub fn ignore_files(files: &mut Vec<String>) -> (bool, Vec<String>) {
|
||||
pub fn _ignore_files(files: &mut Vec<String>) -> (bool, Vec<String>) {
|
||||
let mut ignored_f = vec![];
|
||||
if let Some(path) = path::nextsyncignore() {
|
||||
if let Ok(lines) = read_lines() {
|
||||
files.retain(|file| !ignore_file(file, lines.clone(), &mut ignored_f));
|
||||
}
|
||||
if let Ok(lines) = read_lines() {
|
||||
files.retain(|file| !ignore_file(file, lines.clone(), &mut ignored_f));
|
||||
}
|
||||
(ignored_f.len() > 0, ignored_f)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user