Merge branch 'panic' into 'main'
panic => delete all notes See merge request paris8-rust/rnote!6
This commit is contained in:
commit
9e5f0a3b74
@ -27,6 +27,7 @@ fn main() -> Result<()> {
|
|||||||
("list", Some(m)) => process::list(m)?,
|
("list", Some(m)) => process::list(m)?,
|
||||||
("show", Some(m)) => process::show(m)?,
|
("show", Some(m)) => process::show(m)?,
|
||||||
("search", Some(m)) => process::search(m)?,
|
("search", Some(m)) => process::search(m)?,
|
||||||
|
("panic", _) => process::panic()?,
|
||||||
_ => app.print_long_help()?,
|
_ => app.print_long_help()?,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,4 +73,5 @@ pub fn make_app() -> App<'static, 'static> {
|
|||||||
)
|
)
|
||||||
.arg(Arg::with_name("header").help("Name of the note.")),
|
.arg(Arg::with_name("header").help("Name of the note.")),
|
||||||
)
|
)
|
||||||
|
.subcommand(SubCommand::with_name("panic").help("Delete all notes."))
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ use std::{env, fs, io::Write, os::unix::fs::PermissionsExt, process::Command};
|
|||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
|
|
||||||
/// Get the path to the root directory of all notes.
|
/// Get the path to the root directory of all notes.
|
||||||
fn get_base_path() -> Result<String> {
|
pub fn get_base_path() -> Result<String> {
|
||||||
let home = env::var("HOME")?;
|
let home = env::var("HOME")?;
|
||||||
Ok(format!("{}/.rnote/", home))
|
Ok(format!("{}/.rnote/", home))
|
||||||
}
|
}
|
||||||
|
@ -95,3 +95,9 @@ pub fn show(matches: &ArgMatches) -> Result<()> {
|
|||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn panic() -> Result<()> {
|
||||||
|
let base = notes::get_base_path()?;
|
||||||
|
std::fs::remove_dir_all(base)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user