diff options
Diffstat (limited to 'crates/cli/src/nuke.rs')
| -rw-r--r-- | crates/cli/src/nuke.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/crates/cli/src/nuke.rs b/crates/cli/src/nuke.rs new file mode 100644 index 0000000..1ea6532 --- /dev/null +++ b/crates/cli/src/nuke.rs @@ -0,0 +1,36 @@ +fn help() { + println!("mihi nuke: Nuke the current installation.\n"); + println!("usage: mihi nuke [OPTIONS]\n"); + + println!("Options:"); + println!(" -h, --help\t\tPrint this message."); +} + +pub fn run(args: Vec<String>) { + for arg in args { + match arg.as_str() { + "-h" | "--help" => { + help(); + std::process::exit(0); + } + _ => { + println!("error: nuke: unknown flag: '{}'", arg.as_str()); + std::process::exit(1); + } + } + } + + match mihi::get_config_path() { + Ok(path) => match std::fs::remove_dir_all(path) { + Ok(_) => {} + Err(e) => { + println!("error: nuke: {}", e); + std::process::exit(1); + } + }, + Err(e) => { + println!("error: nuke: {}", e); + std::process::exit(1); + } + } +} |
