euv-cli 0.51.0

Cross-platform CLI tool for the euv native UI framework supporting run, build, check, fmt, doctor, new, and Hyperlane SSE dynamic updates across all supported platforms.
Documentation
use super::*;

/// Conversion helpers between CLI arguments and `euv-core` types.
impl RenderArg {
    /// Converts a `RenderArg` into the core `RenderMode` enum.
    ///
    /// # Returns
    ///
    /// - `RenderMode` - Core rendering pipeline mode.
    #[must_use]
    pub const fn to_render_mode(self) -> RenderMode {
        match self {
            Self::Auto => RenderMode::Auto,
            Self::Software => RenderMode::Software,
            Self::Hardware => RenderMode::Hardware,
            Self::Hybrid => RenderMode::Hybrid,
        }
    }

    /// Returns the CLI flag string forwarded to `euv` applications.
    ///
    /// # Returns
    ///
    /// - `&'static str` - Render flag token.
    #[must_use]
    pub const fn as_flag(self) -> &'static str {
        match self {
            Self::Auto => RENDER_FLAG_AUTO,
            Self::Software => RENDER_FLAG_SOFTWARE,
            Self::Hardware => RENDER_FLAG_HARDWARE,
            Self::Hybrid => RENDER_FLAG_HYBRID,
        }
    }
}

/// Wire string helpers for `HarmonyFormFactorArg`.
impl HarmonyFormFactorArg {
    /// Returns the canonical lowercase form factor label used by HarmonyOS builders.
    ///
    /// # Returns
    ///
    /// - `&'static str` - Lowercase form factor label.
    #[must_use]
    pub const fn as_str(self) -> &'static str {
        match self {
            Self::Phone => HARMONY_FORM_PHONE,
            Self::Tablet => HARMONY_FORM_TABLET,
            Self::Pc => HARMONY_FORM_PC,
            Self::Foldable => HARMONY_FORM_FOLDABLE,
            Self::Tv => HARMONY_FORM_TV,
            Self::Car => HARMONY_FORM_CAR,
            Self::Wearable => HARMONY_FORM_WEARABLE,
        }
    }
}

/// Classification helpers for `TargetArg`.
impl TargetArg {
    /// Returns `true` when this variant represents a multi-target group rather than a single concrete target.
    ///
    /// # Returns
    ///
    /// - `bool` - Whether this selector expands to a group of concrete targets.
    #[must_use]
    pub const fn is_group(self) -> bool {
        matches!(
            self,
            Self::Desktop
                | Self::Mobile
                | Self::Apple
                | Self::Terminal
                | Self::HarmonyAll
                | Self::Wearables
                | Self::Miniapps
                | Self::Quickapps
                | Self::All
        )
    }
}

/// Canonical string helpers for `ProjectTemplateArg`.
impl ProjectTemplateArg {
    /// Returns the canonical lowercase CLI label for this scaffolding template.
    ///
    /// # Returns
    ///
    /// - `&'static str` - Lowercase template label.
    #[must_use]
    pub const fn as_str(self) -> &'static str {
        match self {
            Self::App => TEMPLATE_NAME_APP,
            Self::Web => TEMPLATE_NAME_WEB,
            Self::DynamicWidget => TEMPLATE_NAME_DYNAMIC_WIDGET,
            Self::Docs => TEMPLATE_NAME_DOCS,
        }
    }
}

/// Canonical string helpers for `ShellKindArg`.
impl ShellKindArg {
    /// Returns the canonical lowercase CLI label for this shell dialect.
    ///
    /// # Returns
    ///
    /// - `&'static str` - Lowercase shell dialect label.
    #[must_use]
    pub const fn as_str(self) -> &'static str {
        match self {
            Self::Bash => SHELL_NAME_BASH,
            Self::Zsh => SHELL_NAME_ZSH,
            Self::Fish => SHELL_NAME_FISH,
            Self::Powershell => SHELL_NAME_POWERSHELL,
        }
    }
}