pub struct Directive {
pub cli_flag: &'static str,
pub help: Option<&'static str>,
pub values: Option<ClosedValues>,
pub boolean: bool,
pub repeatable: bool,
pub yaml_directive: Option<&'static str>,
}Expand description
A richer flag descriptor that bundles the CLI form, optional
YAML mirror, value semantics, and repeatability into one
declaration. Adapters can expand a &[Directive] into per-flag
completion + parse rules without the caller writing a parallel
translation layer.
Maps roughly to nbrs’s vocab::Directive shape — a directive is
“the canonical statement of what a flag IS, in every surface
it appears.” Use apply_directives to register a slice of
directives onto a Node in one call.
Fields§
§cli_flag: &'static strCLI form, e.g. "--metric". Required.
help: Option<&'static str>One-line help text. Optional.
values: Option<ClosedValues>Closed value set for both completion and validation. None
means free-form value (or boolean).
boolean: booltrue for boolean flags (no value expected).
repeatable: booltrue when this flag may appear multiple times. Currently
informational; reserved for downstream parsers/validators.
yaml_directive: Option<&'static str>Optional YAML directive mirror. Currently informational; lets downstream YAML parsers cross-reference the same Directive.
Implementations§
Source§impl Directive
impl Directive
Sourcepub const fn closed(
cli_flag: &'static str,
values: &'static [&'static str],
) -> Self
pub const fn closed( cli_flag: &'static str, values: &'static [&'static str], ) -> Self
Construct a value-taking directive with a closed set.
Sourcepub const fn value(cli_flag: &'static str) -> Self
pub const fn value(cli_flag: &'static str) -> Self
Construct a free-form value-taking directive.
Sourcepub const fn repeatable(self) -> Self
pub const fn repeatable(self) -> Self
Builder: mark as repeatable.