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#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
29#[builder(derive(Debug), on(String, into))]
30#[cfg_attr(feature = "clap", derive(clap::Args))]
31#[cfg_attr(feature = "clap", command(about = None, long_about = None))]
32pub struct FilteringOptions {
33 #[cfg_attr(
39 feature = "clap",
40 clap(
41 long,
42 value_name = "NOUL",
43 help = "Filter output using a Jev noul (an assertion evaluated as true or false)",
44 long_help = HELP_JEV
45 )
46 )]
47 #[cfg_attr(
48 feature = "serde",
49 serde(default, skip_serializing_if = "Option::is_none")
50 )]
51 pub jev: Option<String>,
52
53 #[cfg_attr(
57 feature = "clap",
58 clap(
59 long,
60 value_name = "EXPR",
61 help = "Filter and/or transform JSON-LD output using a jq expression",
62 long_help = HELP_JQ
63 )
64 )]
65 #[cfg_attr(
66 feature = "serde",
67 serde(default, skip_serializing_if = "Option::is_none")
68 )]
69 pub jq: Option<String>,
70}