pub struct Spec {Show 16 fields
pub name: String,
pub bin: String,
pub cmd: SpecCommand,
pub config: SpecConfig,
pub version: Option<String>,
pub usage: String,
pub complete: IndexMap<String, SpecComplete>,
pub source_code_link_template: Option<String>,
pub author: Option<String>,
pub about: Option<String>,
pub about_long: Option<String>,
pub about_md: Option<String>,
pub disable_help: Option<bool>,
pub min_usage_version: Option<String>,
pub examples: Vec<SpecExample>,
pub default_subcommand: Option<String>,
}Fields§
§name: String§bin: String§cmd: SpecCommand§config: SpecConfig§version: Option<String>§usage: String§complete: IndexMap<String, SpecComplete>§source_code_link_template: Option<String>§about: Option<String>§about_long: Option<String>§about_md: Option<String>§disable_help: Option<bool>§min_usage_version: Option<String>§examples: Vec<SpecExample>§default_subcommand: Option<String>Default subcommand to use when first non-flag argument is not a known subcommand.
This enables “naked” command syntax like mise foo instead of mise run foo.
Implementations§
Source§impl Spec
impl Spec
Sourcepub fn parse_file(file: &Path) -> Result<Spec, UsageErr>
pub fn parse_file(file: &Path) -> Result<Spec, UsageErr>
Parse a spec from a file.
Automatically detects whether the file is:
- A
.kdlor.usage.kdlfile containing a raw spec - A script file with embedded
# USAGE:comments
If bin is not specified in the spec, it defaults to the filename.
Sourcepub fn parse_script(file: &Path) -> Result<Spec, UsageErr>
pub fn parse_script(file: &Path) -> Result<Spec, UsageErr>
Parse a spec from a script file’s embedded USAGE comments.
Extracts the spec from comment lines starting with # USAGE: or // USAGE:.
If bin is not specified in the spec, it defaults to the filename.
pub fn parse_spec(input: &str) -> Result<Spec, UsageErr>
👎Deprecated
pub fn is_empty(&self) -> bool
pub fn merge(&mut self, other: Spec)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Spec
impl RefUnwindSafe for Spec
impl Send for Spec
impl Sync for Spec
impl Unpin for Spec
impl UnwindSafe for Spec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more