diff --git a/src/bin/grin.rs b/src/bin/grin.rs index 181c35da85..4b15f9ea57 100644 --- a/src/bin/grin.rs +++ b/src/bin/grin.rs @@ -169,6 +169,16 @@ fn real_main() -> i32 { // client commands and options ("client", Some(client_args)) => cmd::client_command(client_args, node_config.unwrap()), + // clean command + ("clean", _) => { + let db_root_path = node_config.unwrap().members.unwrap().server.db_root; + println!("Cleaning chain data directory: {}", db_root_path); + match std::fs::remove_dir_all(db_root_path) { + Ok(_) => 0, + Err(_) => 1, + } + }, + // If nothing is specified, try to just use the config file instead // this could possibly become the way to configure most things // with most command line options being phased out diff --git a/src/bin/grin.yml b/src/bin/grin.yml index e286e475e1..bf953cd3ca 100644 --- a/src/bin/grin.yml +++ b/src/bin/grin.yml @@ -12,6 +12,8 @@ args: long: usernet takes_value: false subcommands: + - clean: + about: Clean Grin chain data - wallet: about: As of v1.1.0, the wallet has been split into a separate executable. See https://github.com/mimblewimble/grin-wallet/releases usage: As of v1.1.0, the wallet has been split into a separate executable. See https://github.com/mimblewimble/grin-wallet/releases to download