Skip to content

fix clashing args in purge-chain cmd #792

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions bin/node/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,14 @@ pub struct PurgeChainCmd {

impl PurgeChainCmd {
pub fn run(&self, database_config: DatabaseSource) -> Result<(), Error> {
self.purge_chain.run(database_config)?;
self.purge_backup.run(self.purge_chain.yes)
self.purge_backup.run(
self.purge_chain.yes,
self.purge_chain
.shared_params
.base_path()?
.ok_or_else(|| Error::Input("need base-path to be provided".to_string()))?,
)?;
self.purge_chain.run(database_config)
}
}

Expand All @@ -319,16 +325,14 @@ impl CliConfiguration for PurgeChainCmd {

#[derive(Debug, Parser)]
pub struct PurgeBackupCmd {
#[clap(flatten)]
pub node_params: NodeParams,
/// Directory under which AlephBFT backup is stored
#[arg(long, default_value = DEFAULT_BACKUP_FOLDER)]
pub backup_dir: String,
}

impl PurgeBackupCmd {
pub fn run(&self, skip_prompt: bool) -> Result<(), Error> {
let backup_path = backup_path(
self.node_params.base_path().path(),
self.node_params.backup_dir(),
);
pub fn run(&self, skip_prompt: bool, base_path: BasePath) -> Result<(), Error> {
let backup_path = backup_path(base_path.path(), &self.backup_dir);

if !skip_prompt {
print!(
Expand Down