ordinary 0.6.0-pre.14

Ordinary CLI
Documentation
// Copyright (C) 2026 Ordinary Labs, LLC.
//
// SPDX-License-Identifier: AGPL-3.0-only

use clap::ValueEnum;
use clap::builder::PossibleValue;

/// units of time
#[derive(Clone, Debug)]
pub enum Time {
    Seconds,
    Millis,
    Micros,
    Nanos,
}

impl ValueEnum for Time {
    fn value_variants<'a>() -> &'a [Self] {
        &[Self::Seconds, Self::Millis, Self::Micros, Self::Nanos]
    }

    fn to_possible_value(&self) -> Option<PossibleValue> {
        match self {
            Self::Seconds => Some(PossibleValue::new("seconds")),
            Self::Millis => Some(PossibleValue::new("millis")),
            Self::Micros => Some(PossibleValue::new("micros")),
            Self::Nanos => Some(PossibleValue::new("nanos")),
        }
    }
}

/// uuid version
#[derive(Clone, Debug)]
pub enum UuidVersion {
    V4,
    V7,
}

impl ValueEnum for UuidVersion {
    fn value_variants<'a>() -> &'a [Self] {
        &[Self::V4]
    }

    fn to_possible_value(&self) -> Option<PossibleValue> {
        match self {
            Self::V4 => Some(PossibleValue::new("4")),
            Self::V7 => Some(PossibleValue::new("7")),
        }
    }
}