use clap::Parser;
#[derive(Parser, Debug, Clone)]
#[command(
name = "dtime",
version = env!("CARGO_PKG_VERSION"),
// disable_version_flag = true,
author = "Hadi Cahyadi <cumulus13@gmail.com>",
about = "A professional cross-platform datetime display utility with colored output",
long_about = "Display current date and time with millisecond precision, timezone information, and colored output. Supports multiple output formats including plain text, colored terminal, and JSON."
)]
pub struct Config {
#[arg(short = 'f', long = "format", default_value = "colored", value_parser = ["colored", "plain", "json"])]
pub output_format: String,
#[arg(short = 'n', long = "no-color")]
pub no_color: bool,
#[arg(short = 'i', long = "iso")]
pub show_iso: bool,
#[arg(short = 'm', long = "monitor", value_name = "SECONDS")]
pub monitor: Option<u64>,
#[arg(short = 't', long = "timezone")]
pub timezone: Option<String>,
}
impl Default for Config {
fn default() -> Self {
Self {
output_format: "colored".to_string(),
no_color: false,
show_iso: false,
monitor: None,
timezone: None,
}
}
}
impl Config {
pub fn from_args() -> Self {
Parser::parse()
}
}