diff options
author | Guillaume Pasquet <dev@etenil.net> | 2022-03-26 09:52:40 +0000 |
---|---|---|
committer | Guillaume Pasquet <dev@etenil.net> | 2022-03-26 09:52:40 +0000 |
commit | f255e22c35da1dd374ef49b0300e6e6ca9c08a80 (patch) | |
tree | beb84a62e263ffaca2e18cb279fba822ffe5afdf /src | |
parent | 6d60900a0bfb41a47744048c7980eefa15c572c8 (diff) |
Fix #18 - Disable filters
Diffstat (limited to 'src')
-rw-r--r-- | src/executor.rs | 7 | ||||
-rw-r--r-- | src/main.rs | 11 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/executor.rs b/src/executor.rs index 0a6e855..4323bc0 100644 --- a/src/executor.rs +++ b/src/executor.rs @@ -130,6 +130,7 @@ impl Executor { bfile: &BarbFile, output: &BarbOutput, filter: &Option<String>, + skip_filters: bool ) -> Result<(), String> { let response = self.run(&bfile, self.make_req(&bfile, output))?; //let response = executor.execute(&bfile, &output)?; @@ -143,7 +144,11 @@ impl Executor { } output.end_resp_hdr(); - output.body(self.apply_filters(&bfile, response.into_string().unwrap(), filter)?); + if ! skip_filters { + output.body(self.apply_filters(&bfile, response.into_string().unwrap(), filter)?); + } else { + output.body(response.into_string().unwrap()); + } Ok(()) } diff --git a/src/main.rs b/src/main.rs index 0cd839c..151b277 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,6 +24,8 @@ struct Args { filter: Option<String>, #[clap(short, long)] no_color: bool, + #[clap(short = 'F', long)] + no_filter: bool, files: Vec<String>, } @@ -36,6 +38,10 @@ impl Args { &self.filter } + pub fn no_filter(&self) -> bool { + self.no_filter + } + pub fn output(&self) -> BarbOutput { BarbOutput::new( !self.body, @@ -83,7 +89,8 @@ fn main() { dependencies.dedup(); for dep in dependencies { - match executor.execute(&dep, &output, args.jq_filter()) { + // Always enable filters on dependencies + match executor.execute(&dep, &output, args.jq_filter(), false) { Ok(()) => (), Err(err) => println!("{}", err), } @@ -95,7 +102,7 @@ fn main() { continue; } - match executor.execute(&bfile.unwrap(), &output, args.jq_filter()) { + match executor.execute(&bfile.unwrap(), &output, args.jq_filter(), args.no_filter()) { Ok(()) => (), Err(err) => println!("{}", err), } |