Adds command to remove chain_data (#2954)

This commit is contained in:
pharazen 2019-07-25 04:13:56 -05:00 committed by Antioch Peverell
parent 2ae76d39bb
commit 45cf1d96df
2 changed files with 12 additions and 0 deletions

View file

@ -169,6 +169,16 @@ fn real_main() -> i32 {
// client commands and options // client commands and options
("client", Some(client_args)) => cmd::client_command(client_args, node_config.unwrap()), ("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 // If nothing is specified, try to just use the config file instead
// this could possibly become the way to configure most things // this could possibly become the way to configure most things
// with most command line options being phased out // with most command line options being phased out

View file

@ -12,6 +12,8 @@ args:
long: usernet long: usernet
takes_value: false takes_value: false
subcommands: subcommands:
- clean:
about: Clean Grin chain data
- wallet: - wallet:
about: As of v1.1.0, the wallet has been split into a separate executable. See https://github.com/mimblewimble/grin-wallet/releases 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 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