add store
This commit is contained in:
parent
e405ce7f8f
commit
3da439ccf6
@ -1,5 +1,6 @@
|
||||
use clap::Values;
|
||||
use crate::utils;
|
||||
use crate::store;
|
||||
use std::path::Path;
|
||||
use std::io::Write;
|
||||
|
||||
@ -14,7 +15,7 @@ pub fn add(files: Values<'_>) {
|
||||
|
||||
let mut index_path = root.clone();
|
||||
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
|
||||
// ./folder ./folder/file
|
||||
|
||||
|
@ -9,7 +9,7 @@ use xml::reader::{EventReader, XmlEvent};
|
||||
use crate::services::api::ApiError;
|
||||
use crate::services::list_folders::ListFolders;
|
||||
use crate::services::download_files::DownloadFiles;
|
||||
use crate::utils::object;
|
||||
use crate::store::object;
|
||||
use crate::commands;
|
||||
use crate::global::global::{DIR_PATH, set_dir_path};
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
use crate::utils::path;
|
||||
use crate::utils::read;
|
||||
use crate::utils::{path, read};
|
||||
use std::fs::OpenOptions;
|
||||
use std::io::{self, Write};
|
||||
|
||||
|
@ -5,7 +5,8 @@ use std::collections::HashMap;
|
||||
use colored::Colorize;
|
||||
use std::path::PathBuf;
|
||||
use std::io::{self, Lines, BufReader};
|
||||
use crate::utils::{self, object};
|
||||
use crate::utils;
|
||||
use crate::store::{self, object};
|
||||
|
||||
#[derive(PartialEq)]
|
||||
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 {
|
||||
// todo hash this
|
||||
staged_objs.push(String::from(entry.unwrap()));
|
||||
|
@ -3,6 +3,7 @@ mod commands;
|
||||
mod utils;
|
||||
mod services;
|
||||
mod global;
|
||||
mod store;
|
||||
|
||||
fn main() {
|
||||
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 crate::utils::{read, head, path};
|
||||
use crate::utils::{read, path};
|
||||
use crate::store::head;
|
||||
use crypto::sha1::Sha1;
|
||||
use crypto::digest::Digest;
|
||||
use std::fs::{OpenOptions, self};
|
@ -1,5 +1,2 @@
|
||||
pub mod path;
|
||||
pub mod index;
|
||||
pub mod head;
|
||||
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