pub struct ApcliGroup { /* private fields */ }Expand description
Visibility configuration for the built-in apcli command group.
Instantiated via ApcliGroup::from_cli_config (Tier 1) or
ApcliGroup::from_yaml (Tier 3). The constructor is private to
preserve the Tier-1-vs-Tier-3 flag distinction.
Implementations§
Source§impl ApcliGroup
impl ApcliGroup
Sourcepub fn from_cli_config(
config: Option<ApcliConfig>,
registry_injected: bool,
) -> Self
pub fn from_cli_config( config: Option<ApcliConfig>, registry_injected: bool, ) -> Self
Tier 1 constructor — config came from a programmatic embedder
(i.e. an ApcliConfig value passed to a future embedding API).
A non-auto mode from this tier wins over env var and yaml. Because
ApcliConfig is strongly typed, no validation is needed here.
Sourcepub fn from_yaml(yaml_value: Option<Value>, registry_injected: bool) -> Self
pub fn from_yaml(yaml_value: Option<Value>, registry_injected: bool) -> Self
Tier 3 constructor — config came from apcore.yaml.
Env var (Tier 2) may override the yaml-supplied mode unless
disable_env is true. On validation error, prints a message to stderr
and calls std::process::exit with EXIT_INVALID_INPUT; the
fallible variant ApcliGroup::try_from_yaml is available for tests.
Sourcepub fn try_from_yaml(
yaml_value: Option<Value>,
registry_injected: bool,
) -> Result<Self, ApcliGroupError>
pub fn try_from_yaml( yaml_value: Option<Value>, registry_injected: bool, ) -> Result<Self, ApcliGroupError>
Fallible sibling of ApcliGroup::from_yaml. Used by tests; the
production wrapper prints the error and exits.
Sourcepub fn resolve_visibility(&self) -> &'static str
pub fn resolve_visibility(&self) -> &'static str
Resolve effective visibility after applying the four-tier precedence.
Returns one of "all" | "none" | "include" | "exclude" — never
"auto". Tier order (spec §4.4):
from_cli_configwith a non-auto mode wins outright.APCORE_CLI_APCLIenv var (unless sealed bydisable_env).- yaml non-auto mode.
- Auto-detect:
registry_injected ? "none" : "all".
Sourcepub fn is_subcommand_included(&self, subcommand: &str) -> bool
pub fn is_subcommand_included(&self, subcommand: &str) -> bool
Return true iff subcommand passes the include/exclude filter.
Callers MUST first check ApcliGroup::resolve_visibility — this
method panics if called under modes "all" or "none" (caller bug
per spec §4.6).
Sourcepub fn is_group_visible(&self) -> bool
pub fn is_group_visible(&self) -> bool
True iff the apcli group itself should appear in root --help.
Sourcepub fn include(&self) -> &[String]
pub fn include(&self) -> &[String]
Enumerate the effective include list. Empty unless resolved mode is
"include".
Sourcepub fn exclude(&self) -> &[String]
pub fn exclude(&self) -> &[String]
Enumerate the effective exclude list. Empty unless resolved mode is
"exclude".
Sourcepub fn disable_env(&self) -> bool
pub fn disable_env(&self) -> bool
True iff Tier 2 env-var lookup is sealed.