Skip to content

Commit

Permalink
Added diff flag to avoid unneccessary diffs
Browse files Browse the repository at this point in the history
  • Loading branch information
johannwagner committed Nov 18, 2024
1 parent 36b91f2 commit bd11d16
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ struct Cli {
#[arg(long, short, action=ArgAction::SetTrue)]
debug: bool,

#[arg(long, short, action=ArgAction::SetTrue)]
diff: bool,

#[command(subcommand)]
command: Commands,
}
Expand Down Expand Up @@ -128,7 +131,9 @@ fn main() {
let diff_reply = netconf_session
.diff_configuration("text".to_string())
.unwrap();
println!("{}", diff_reply);
if cli.diff {
println!("{}", diff_reply);
}

eprintln!("Applying configuration...");

Expand All @@ -154,7 +159,9 @@ fn main() {
let diff_reply = netconf_session
.diff_configuration("text".to_string())
.unwrap();
println!("{}", diff_reply);
if cli.diff {
println!("{}", diff_reply);
}

eprintln!("Applying configuration...");

Expand Down Expand Up @@ -182,8 +189,9 @@ fn main() {
let diff_reply = netconf_session
.diff_configuration("text".to_string())
.unwrap();
println!("{}", diff_reply);

if cli.diff {
println!("{}", diff_reply);
}
let _ = netconf_session.unlock_configuration().unwrap();
}
}
Expand Down

0 comments on commit bd11d16

Please sign in to comment.