use clap::{Parser, Subcommand, ValueEnum, command, crate_version};
use crate::integrations::taiga::Status;
#[derive(Parser)]
#[command(version, about, long_about = None, before_help = format!(r#"
▗▄▄▖ ▗▞▀▜▌▗▞▀▘█ ▄ █ ▄▄▄ ▄▄▄
▐▌ ▐▌▝▚▄▟▌▝▚▄▖█▄▀ █ █ █ █
▐▛▀▚▖ █ ▀▄ █ ▀▄▄▄▀ █
▐▙▄▞▘ █ █ █ ▗▄▖
▐▌ ▐▌
▝▀▜▌
▐▙▄▞▘
@lauacosta/backlogr {}"#, crate_version!()
))
]
pub struct Cli {
#[arg(long = "username", env = "USERNAME", required = true)]
pub username: String,
#[arg(long = "password", env = "PASSWORD", required = true)]
pub password: String,
#[arg(long = "project_name", env = "PROJECT_NAME", required = true)]
pub project_name: String,
#[command(subcommand)]
pub command: Option<Command>,
}
impl Cli {
#[must_use]
pub fn command(&self) -> Command {
self.command.clone().unwrap_or(Command::List {
format: Format::Pretty,
})
}
}
#[derive(Subcommand, Clone, Debug)]
pub enum Command {
Create {
#[arg(long = "subject")]
subject: String,
#[arg(long = "description")]
description: Option<String>,
#[arg(long = "description", value_enum, default_value_t = Status::New)]
status: Status,
},
Wip { story_id: usize },
Done { story_id: usize },
Delete { story_id: usize },
List {
#[arg(short, long = "format", value_enum, default_value_t = Format::Pretty)]
format: Format,
},
}
#[derive(Debug, Clone, ValueEnum)]
pub enum Format {
Pretty,
Json,
}