mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 17:57:56 +00:00
Add grandpa telemetry (+ other minor improvements) (#1997)
* Support skipping the interactive purge prompt Skip it via `cargo run -- purge-chain -y`. * Fix typos * Add Grandpa telemetry * Address comments * Revert unnecessary version bump * Version bump to make CI run * Remove unnecessary cast * Do not bump version
This commit is contained in:
committed by
Bastian Köcher
parent
35a67b31e5
commit
c52c528ee8
@@ -574,23 +574,28 @@ where
|
||||
S: FnOnce(&str) -> Result<Option<ChainSpec<FactoryGenesis<F>>>, String>,
|
||||
{
|
||||
let config = create_config_with_db_path::<F, _>(spec_factory, &cli.shared_params, version)?;
|
||||
|
||||
let db_path = config.database_path;
|
||||
print!("Are you sure to remove {:?}? (y/n)", &db_path);
|
||||
stdout().flush().expect("failed to flush stdout");
|
||||
|
||||
let mut input = String::new();
|
||||
stdin().read_line(&mut input)?;
|
||||
let input = input.trim();
|
||||
if cli.yes == false {
|
||||
print!("Are you sure to remove {:?}? (y/n)", &db_path);
|
||||
stdout().flush().expect("failed to flush stdout");
|
||||
|
||||
match input.chars().nth(0) {
|
||||
Some('y') | Some('Y') => {
|
||||
fs::remove_dir_all(&db_path)?;
|
||||
println!("{:?} removed.", &db_path);
|
||||
},
|
||||
_ => println!("Aborted"),
|
||||
let mut input = String::new();
|
||||
stdin().read_line(&mut input)?;
|
||||
let input = input.trim();
|
||||
|
||||
match input.chars().nth(0) {
|
||||
Some('y') | Some('Y') => {},
|
||||
_ => {
|
||||
println!("Aborted");
|
||||
return Ok(());
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
fs::remove_dir_all(&db_path)?;
|
||||
println!("{:?} removed.", &db_path);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -338,6 +338,10 @@ impl_get_log_filter!(RevertCmd);
|
||||
/// The `purge-chain` command used to remove the whole chain.
|
||||
#[derive(Debug, StructOpt, Clone)]
|
||||
pub struct PurgeChainCmd {
|
||||
/// Skip interactive prompt by answering yes automatically.
|
||||
#[structopt(short = "y")]
|
||||
pub yes: bool,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[structopt(flatten)]
|
||||
pub shared_params: SharedParams,
|
||||
|
||||
Reference in New Issue
Block a user