nestrs-cli-rs 0.1.0

Rust port of the Nest CLI for the nestrs organization.
Documentation
//! Upstream source: `../nest-cli/commands/command.input.ts`.

/// A command/action input value accepted by upstream Nest CLI commands.
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum InputValue {
    Bool(bool),
    String(String),
    StringList(Vec<String>),
}

/// Extra metadata attached to an input by some commander callbacks.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct InputOptions {
    pub passed_as_input: bool,
}

/// Rust representation of upstream `commands/command.input.ts`.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Input {
    pub name: String,
    pub value: Option<InputValue>,
    pub options: Option<InputOptions>,
}

impl Input {
    pub fn new(name: impl Into<String>, value: Option<InputValue>) -> Self {
        Self {
            name: name.into(),
            value,
            options: None,
        }
    }

    pub fn with_options(
        name: impl Into<String>,
        value: Option<InputValue>,
        options: InputOptions,
    ) -> Self {
        Self {
            name: name.into(),
            value,
            options: Some(options),
        }
    }
}