pub struct UiArgs {
pub dry_run: bool,
pub install_dir: Option<String>,
pub force: bool,
}Expand description
Parsed common arguments for UI installer scripts.
Provides struct-based parsing for --dry-run, --dir <path>, --force,
and --help flags, matching the behavior of ui_parse_common_args from
the shell scripts.
§Validation
- VAL-INFRA-015: CLI arg parsing with path validation
Fields§
§dry_run: boolWhether dry-run mode is enabled.
install_dir: Option<String>The installation directory (absolute path).
force: boolWhether –force was specified (no-op for UI installers, accepted for compatibility).
Implementations§
Source§impl UiArgs
impl UiArgs
Sourcepub fn parse(args: &[&str]) -> Result<Self, UiArgError>
pub fn parse(args: &[&str]) -> Result<Self, UiArgError>
Parse command-line arguments into UiArgs.
Supports:
--dry-run— enable dry-run mode--dir <path>— set installation directory (must be absolute)--force— accepted for compatibility (no-op for UI installers)--help/-h— print usage and returnErr(2)(matching shell behavior)
Returns an error if:
--diris provided without a path argument--dirpath is not absolute--dirtargets a sensitive system directory
Sourcepub fn install_dir_or<'a>(&'a self, default: &'a str) -> &'a str
pub fn install_dir_or<'a>(&'a self, default: &'a str) -> &'a str
Get the installation directory, or a default.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UiArgs
impl RefUnwindSafe for UiArgs
impl Send for UiArgs
impl Sync for UiArgs
impl Unpin for UiArgs
impl UnsafeUnpin for UiArgs
impl UnwindSafe for UiArgs
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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