diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-06-03 21:49:25 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-06-03 21:49:25 +0200 |
| commit | 28c011c7b3ebd8f5aae111551222ed3748937b33 (patch) | |
| tree | f6310107b9fbdabeda1cce46e2feb2cb85d1ce1a /crates/cli/src/nuke.rs | |
| download | mihi-28c011c7b3ebd8f5aae111551222ed3748937b33.tar.gz mihi-28c011c7b3ebd8f5aae111551222ed3748937b33.zip | |
Initial commit
Basic commands have been added, but most of the features for this
project are still work in progress.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
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); + } + } +} |
