use std::path::PathBuf;
use clap::{Args, Parser, Subcommand};
#[derive(Debug, Parser)]
#[command(name = "wipe", version, about, long_about = None, propagate_version = true)]
pub struct Cli {
#[arg(long, global = true)]
pub json: bool,
#[arg(short = 'C', long = "cwd", global = true, value_name = "PATH")]
pub cwd: Option<PathBuf>,
#[command(subcommand)]
pub command: Command,
}
#[derive(Debug, Subcommand)]
pub enum Command {
Init(InitArgs),
Status,
#[command(subcommand)]
Board(BoardCmd),
#[command(subcommand)]
List(ListCmd),
#[command(subcommand)]
Ticket(TicketCmd),
#[command(subcommand)]
Comment(CommentCmd),
#[command(subcommand)]
Label(LabelCmd),
#[command(subcommand)]
Media(MediaCmd),
Serve(ServeArgs),
#[command(subcommand)]
Config(ConfigCmd),
Doctor,
Skill,
}
#[derive(Debug, Args)]
pub struct InitArgs {
#[arg(default_value = ".")]
pub path: PathBuf,
#[arg(long)]
pub name: Option<String>,
}
#[derive(Debug, Subcommand)]
pub enum BoardCmd {
Show,
Rename {
name: String,
},
}
#[derive(Debug, Subcommand)]
pub enum ListCmd {
Show,
Add {
name: String,
},
Rename {
id: String,
name: String,
},
Move {
id: String,
index: usize,
},
Remove {
id: String,
#[arg(long)]
force: bool,
},
}
#[derive(Debug, Subcommand)]
pub enum TicketCmd {
Create(TicketCreateArgs),
Show {
id: String,
},
Edit(TicketEditArgs),
Move {
id: String,
#[arg(long)]
to: String,
#[arg(long)]
pos: Option<usize>,
},
Assign {
id: String,
who: String,
#[arg(long)]
remove: bool,
},
Close {
id: String,
},
Reopen {
id: String,
},
Delete {
id: String,
#[arg(long)]
yes: bool,
},
List(TicketListArgs),
}
#[derive(Debug, Args)]
pub struct TicketCreateArgs {
#[arg(long, short)]
pub title: String,
#[arg(long, short)]
pub body: Option<String>,
#[arg(long)]
pub priority: Option<String>,
#[arg(long, short = 'l')]
pub list: Option<String>,
#[arg(long = "label", value_name = "LABEL")]
pub labels: Vec<String>,
#[arg(long = "assignee", value_name = "WHO")]
pub assignees: Vec<String>,
}
#[derive(Debug, Args)]
pub struct TicketEditArgs {
pub id: String,
#[arg(long)]
pub title: Option<String>,
#[arg(long)]
pub body: Option<String>,
#[arg(long)]
pub priority: Option<String>,
}
#[derive(Debug, Args)]
pub struct TicketListArgs {
#[arg(long)]
pub list: Option<String>,
#[arg(long)]
pub label: Option<String>,
}
#[derive(Debug, Subcommand)]
pub enum CommentCmd {
Add {
ticket: String,
#[arg(long, short)]
body: String,
#[arg(long)]
author: Option<String>,
},
List {
ticket: String,
},
}
#[derive(Debug, Subcommand)]
pub enum LabelCmd {
Create {
name: String,
#[arg(long)]
color: Option<String>,
#[arg(long)]
description: Option<String>,
},
List,
Delete {
name: String,
},
Assign {
ticket: String,
name: String,
},
Remove {
ticket: String,
name: String,
},
}
#[derive(Debug, Subcommand)]
pub enum MediaCmd {
Add {
ticket: String,
path: PathBuf,
},
List {
ticket: String,
},
Remove {
ticket: String,
name: String,
},
}
#[derive(Debug, Args)]
pub struct ServeArgs {
#[arg(long)]
pub port: Option<u16>,
#[arg(long)]
pub open: bool,
}
#[derive(Debug, Subcommand)]
pub enum ConfigCmd {
Show,
Get {
key: String,
},
Set {
key: String,
value: String,
},
}