Skip to content

Commit 934e6e7

Browse files
committed
debug: add --quiet flag
1 parent db67087 commit 934e6e7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

regex-debug/src/main.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Options:
5151
extracted.
5252
--searcher Show the debug output for the literal searcher
5353
constructed by the literals found.
54+
--quiet Show less output.
5455
";
5556

5657
#[derive(Deserialize)]
@@ -80,6 +81,7 @@ struct Args {
8081
flag_lcp: bool,
8182
flag_lcs: bool,
8283
flag_searcher: bool,
84+
flag_quiet: bool,
8385
}
8486

8587
type Result<T> = result::Result<T, Box<dyn error::Error + Send + Sync>>;
@@ -214,7 +216,11 @@ fn cmd_compile(args: &Args) -> Result<()> {
214216
.dfa(args.flag_dfa)
215217
.reverse(args.flag_dfa_reverse);
216218
let prog = compiler.compile(&exprs)?;
217-
print!("{:?}", prog);
219+
if !args.flag_quiet {
220+
print!("{:?}", prog);
221+
} else {
222+
println!("instruction count: {}", prog.insts.len());
223+
}
218224
Ok(())
219225
}
220226

0 commit comments

Comments
 (0)