asimov_patterns/options/
filtering.rs1use alloc::string::String;
6use bon::Builder;
7
8#[cfg(feature = "clap")]
9const HELP_JEV: &str = r#"Filter output using a Jev noul: an assertion evaluated as true or false.
10
11Use an assertion such as "The name is Ukrainian", rather than a question.
12Jev filtering is applied before --jq."#;
13
14#[cfg(feature = "clap")]
15const HELP_JQ: &str = r#"Filter and/or transform JSON-LD output using a jq expression.
16
17For example, "select(.name)". When --jev is also specified, jq is applied after
18Jev filtering."#;
19
20#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd, Builder)]
28#[builder(derive(Debug), on(String, into))]
29#[cfg_attr(feature = "clap", derive(clap::Args))]
30#[cfg_attr(feature = "clap", command(about = None, long_about = None))]
31pub struct FilteringOptions {
32 #[cfg_attr(
38 feature = "clap",
39 clap(
40 long,
41 value_name = "NOUL",
42 help = "Filter output using a Jev noul (an assertion evaluated as true or false)",
43 long_help = HELP_JEV
44 )
45 )]
46 pub jev: Option<String>,
47
48 #[cfg_attr(
52 feature = "clap",
53 clap(
54 long,
55 value_name = "EXPR",
56 help = "Filter and/or transform JSON-LD output using a jq expression",
57 long_help = HELP_JQ
58 )
59 )]
60 pub jq: Option<String>,
61}