aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Pasquet <dev@etenil.net>2022-03-26 09:52:40 +0000
committerGuillaume Pasquet <dev@etenil.net>2022-03-26 09:52:40 +0000
commitf255e22c35da1dd374ef49b0300e6e6ca9c08a80 (patch)
treebeb84a62e263ffaca2e18cb279fba822ffe5afdf /src
parent6d60900a0bfb41a47744048c7980eefa15c572c8 (diff)
Fix #18 - Disable filters
Diffstat (limited to 'src')
-rw-r--r--src/executor.rs7
-rw-r--r--src/main.rs11
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),
}