Skip to content

Commit bd11d16

Browse files
committed
Added diff flag to avoid unneccessary diffs
1 parent 36b91f2 commit bd11d16

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/main.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ struct Cli {
2323
#[arg(long, short, action=ArgAction::SetTrue)]
2424
debug: bool,
2525

26+
#[arg(long, short, action=ArgAction::SetTrue)]
27+
diff: bool,
28+
2629
#[command(subcommand)]
2730
command: Commands,
2831
}
@@ -128,7 +131,9 @@ fn main() {
128131
let diff_reply = netconf_session
129132
.diff_configuration("text".to_string())
130133
.unwrap();
131-
println!("{}", diff_reply);
134+
if cli.diff {
135+
println!("{}", diff_reply);
136+
}
132137

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

@@ -154,7 +159,9 @@ fn main() {
154159
let diff_reply = netconf_session
155160
.diff_configuration("text".to_string())
156161
.unwrap();
157-
println!("{}", diff_reply);
162+
if cli.diff {
163+
println!("{}", diff_reply);
164+
}
158165

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

@@ -182,8 +189,9 @@ fn main() {
182189
let diff_reply = netconf_session
183190
.diff_configuration("text".to_string())
184191
.unwrap();
185-
println!("{}", diff_reply);
186-
192+
if cli.diff {
193+
println!("{}", diff_reply);
194+
}
187195
let _ = netconf_session.unlock_configuration().unwrap();
188196
}
189197
}

0 commit comments

Comments
 (0)