Skip to content

Commit

Permalink
🗑️ use if let for cli command
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdelStark committed Feb 6, 2024
1 parent e132790 commit 25aaa2a
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,12 @@ enum Commands {
fn main() {
let cli = Cli::parse();

match cli.command {
Some(Commands::Recover { blob_file }) => {
let blob_file = blob_file.unwrap();
let blob_data = serde::parse_file_to_blob_data(blob_file.to_str().unwrap());
let original_data = blob::recover(blob_data);
let state_diffs = serde::parse_state_diffs(original_data.as_slice());
let state_diffs_json = serde::to_json(state_diffs.as_slice());
println!("{}", state_diffs_json);
}
None => {
println!("No command provided");
}
if let Some(Commands::Recover { blob_file }) = cli.command {
let blob_file = blob_file.unwrap();
let blob_data = serde::parse_file_to_blob_data(blob_file.to_str().unwrap());
let original_data = blob::recover(blob_data);
let state_diffs = serde::parse_state_diffs(original_data.as_slice());
let state_diffs_json = serde::to_json(state_diffs.as_slice());
println!("{}", state_diffs_json);
}
}

0 comments on commit 25aaa2a

Please sign in to comment.