From 700df3460391a15c747bc812369a93cdbdacafa3 Mon Sep 17 00:00:00 2001 From: Feliciss <10203-feliciss@users.noreply.0xacab.org> Date: Wed, 21 Aug 2024 03:29:58 +0900 Subject: [PATCH] [gh-2471] fix syntax errors. --- .../commands/transaction/commands/build.rs | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/crates/rooch/src/commands/transaction/commands/build.rs b/crates/rooch/src/commands/transaction/commands/build.rs index b60864c07d..f764ffa8d3 100644 --- a/crates/rooch/src/commands/transaction/commands/build.rs +++ b/crates/rooch/src/commands/transaction/commands/build.rs @@ -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, + file_destination: Option, /// Return command outputs in json format #[clap(long, default_value = "false")] @@ -100,18 +100,16 @@ impl CommandAction> 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(), + )); } } }