diff --git a/.gitignore b/.gitignore index 10885cb..fbcc087 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ target *.test .env todo +.nextsync +.nextsyncignore diff --git a/src/commands/init.rs b/src/commands/init.rs index 9e1d76b..57478d6 100644 --- a/src/commands/init.rs +++ b/src/commands/init.rs @@ -1,9 +1,20 @@ -use std::fs::DirBuilder; +use std::fs::{DirBuilder, File}; +use std::env; pub fn init() { let builder = DirBuilder::new(); - match builder.create("./test/dir") { + let mut path = env::current_dir().unwrap(); + path.push(".nextsync"); + match builder.create(path.clone()) { Ok(()) => println!("Directory successfuly created"), Err(_) => println!("Error: cannot create directory"), } + + path.pop(); + path.push(".nextsyncignore"); + + match File::create(path) { + Ok(_) => println!("File successfuly created"), + Err(_) => println!("Error: cannot create .nextsyncignore"), + } }