add store
This commit is contained in:
parent
e405ce7f8f
commit
3da439ccf6
@ -1,5 +1,6 @@
|
|||||||
use clap::Values;
|
use clap::Values;
|
||||||
use crate::utils;
|
use crate::utils;
|
||||||
|
use crate::store;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ pub fn add(files: Values<'_>) {
|
|||||||
|
|
||||||
let mut index_path = root.clone();
|
let mut index_path = root.clone();
|
||||||
index_path.push(".nextsync");
|
index_path.push(".nextsync");
|
||||||
let mut index_file = utils::index::open(index_path);
|
let mut index_file = store::index::open(index_path);
|
||||||
// todo avoid duplicate
|
// todo avoid duplicate
|
||||||
// ./folder ./folder/file
|
// ./folder ./folder/file
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ use xml::reader::{EventReader, XmlEvent};
|
|||||||
use crate::services::api::ApiError;
|
use crate::services::api::ApiError;
|
||||||
use crate::services::list_folders::ListFolders;
|
use crate::services::list_folders::ListFolders;
|
||||||
use crate::services::download_files::DownloadFiles;
|
use crate::services::download_files::DownloadFiles;
|
||||||
use crate::utils::object;
|
use crate::store::object;
|
||||||
use crate::commands;
|
use crate::commands;
|
||||||
use crate::global::global::{DIR_PATH, set_dir_path};
|
use crate::global::global::{DIR_PATH, set_dir_path};
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use crate::utils::path;
|
use crate::utils::{path, read};
|
||||||
use crate::utils::read;
|
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@ use std::collections::HashMap;
|
|||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::io::{self, Lines, BufReader};
|
use std::io::{self, Lines, BufReader};
|
||||||
use crate::utils::{self, object};
|
use crate::utils;
|
||||||
|
use crate::store::{self, object};
|
||||||
|
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
enum RemoveSide {
|
enum RemoveSide {
|
||||||
@ -80,7 +81,7 @@ pub fn get_diff() -> (Vec<String>, Vec<String>, Vec<Obj>) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(entries) = utils::index::read_line(nextsync_path.clone()) {
|
if let Ok(entries) = store::index::read_line(nextsync_path.clone()) {
|
||||||
for entry in entries {
|
for entry in entries {
|
||||||
// todo hash this
|
// todo hash this
|
||||||
staged_objs.push(String::from(entry.unwrap()));
|
staged_objs.push(String::from(entry.unwrap()));
|
||||||
|
@ -3,6 +3,7 @@ mod commands;
|
|||||||
mod utils;
|
mod utils;
|
||||||
mod services;
|
mod services;
|
||||||
mod global;
|
mod global;
|
||||||
|
mod store;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let matches = App::new("NextSync")
|
let matches = App::new("NextSync")
|
||||||
|
3
src/store.rs
Normal file
3
src/store.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
pub mod index;
|
||||||
|
pub mod head;
|
||||||
|
pub mod object;
|
@ -1,5 +1,6 @@
|
|||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use crate::utils::{read, head, path};
|
use crate::utils::{read, path};
|
||||||
|
use crate::store::head;
|
||||||
use crypto::sha1::Sha1;
|
use crypto::sha1::Sha1;
|
||||||
use crypto::digest::Digest;
|
use crypto::digest::Digest;
|
||||||
use std::fs::{OpenOptions, self};
|
use std::fs::{OpenOptions, self};
|
@ -1,5 +1,2 @@
|
|||||||
pub mod path;
|
pub mod path;
|
||||||
pub mod index;
|
|
||||||
pub mod head;
|
|
||||||
pub mod read;
|
pub mod read;
|
||||||
pub mod object;
|
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
src/utils/object.rs
|
|
||||||
todo
|
|
||||||
src/utils/head.rs
|
|
||||||
src/utils/read.rs
|
|
Loading…
Reference in New Issue
Block a user