reset command

This commit is contained in:
grimhilt
2023-06-03 17:37:23 +02:00
parent eedb003d8c
commit 1a1b98729a
3 changed files with 21 additions and 0 deletions

17
src/commands/reset.rs Normal file
View File

@@ -0,0 +1,17 @@
use std::fs::File;
use crate::utils;
pub fn reset() {
let mut root = match utils::path::nextsync_root() {
Some(path) => path,
None => {
eprintln!("fatal: not a nextsync repository (or any of the parent directories): .nextsync");
std::process::exit(1);
}
};
root.push(".nextsync");
root.push("index");
if File::create(root).is_err() {
eprintln!("fatal: failed to reset");
}
}