pub enum ArgType {
String,
Path,
Int,
Duration,
List,
Any,
OneOf(&'static [&'static str]),
Rest(&'static ArgType),
}Expand description
Closed vocabulary for argument value types: every variant names a
type explicitly present in the app, so the reference table never
lists a type that does not exist. Shapes ($var targets, KEY=value
pairs) are not types: the central validator only checks value types
and arity, while each command’s lower enforces its own shapes with
command-specific errors.
ArgType::Any is the single exception: it renders as <any>,
visibly a placeholder rather than a type name.
ArgType::OneOf renders its inline options, likewise self-describing.
Variants§
String
Path
Int
Duration
List
A $variable that must hold a LIST at runtime. Non-variable
expressions fail at lower time; renders linked as LIST.
Any
Any evaluated value (plus stream markers like stdout where the
command accepts them). Renders unlinked as <any>, visibly a
placeholder rather than a type name.
OneOf(&'static [&'static str])
Inline alternation for one-off enums (e.g. SNAPSHOT|LOCAL).
Self-describing, so it renders unlinked.
Rest(&'static ArgType)
Trailing variadic repetition (e.g. RUN’s string...).
Implementations§
Source§impl ArgType
impl ArgType
Sourcepub fn label(&self) -> String
pub fn label(&self) -> String
Table-cell label for the argument table’s Type column.
Canonical value types use their descriptor names; ANY renders
as <any> and inline alternations render their options, so
neither reads as a standalone type. Shapes ($var targets,
KEY=value pairs) are validated in each command’s lower, and
the shape requirement lives in the argument description and
command syntax.
Sourcepub fn anchor(&self) -> Option<String>
pub fn anchor(&self) -> Option<String>
Anchor of the type’s reference section. Only types with a value-type
reference section link; <any> and inline alternations render
unlinked.
Sourcepub fn validate_literal(&self, literal: &str) -> Result<()>
pub fn validate_literal(&self, literal: &str) -> Result<()>
Validate a statically-known literal against this type.
Templates and variables are never passed here — see check_arg.
Sourcepub fn check_arg(&self, arg: &Arg) -> Result<CheckOutcome>
pub fn check_arg(&self, arg: &Arg) -> Result<CheckOutcome>
Classify one positional arg for lower-time checking.
Static literals validate now; templates, variables (except a
$var where List is required), and mixed fragments defer to the
runtime resolvers, which see interpolated values.