Skip to content

Commit

Permalink
[rooch-networkgh-2471] fix syntax errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
Feliciss committed Aug 20, 2024
1 parent 2a6148e commit 700df34
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions crates/rooch/src/commands/transaction/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ pub struct BuildCommand {
#[clap(long, default_value = "false")]
output: bool,

/// File location for the file being written
/// File destination for the file being written
#[clap(long)]
file_location: Option<String>,
file_destination: Option<String>,

/// Return command outputs in json format
#[clap(long, default_value = "false")]
Expand Down Expand Up @@ -100,18 +100,16 @@ impl CommandAction<Option<String>> for BuildCommand {

Ok(None)
}
} else {
if let Some(file_location) = self.file_location {
let mut file = File::create(file_location)?;
file.write_all(&tx_data.encode())?;
println!("Write encoded tx data succeeded in the designated location");
} else if let Some(file_destination) = self.file_destination {
let mut file = File::create(file_destination)?;
file.write_all(&tx_data.encode())?;
println!("Write encoded tx data succeeded in the destination");

Ok(None)
} else {
return Err(RoochError::CommandArgumentError(format!(
"Argument --file-location is not provided",
)));
}
Ok(None)
} else {
return Err(RoochError::CommandArgumentError(
"Argument --file-destination is not provided".to_owned(),
));
}
}
}

0 comments on commit 700df34

Please sign in to comment.