use std::path::PathBuf;
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(name = "tasks", version, about = "Markdown-based TODO task management CLI")]
pub struct Cli {
#[command(subcommand)]
pub command: Command,
}
#[derive(Subcommand)]
pub enum Command {
Info,
Lib {
#[command(subcommand)]
command: LibCommand,
},
New {
title: String,
#[arg(short, long)]
priority: Option<String>,
#[arg(short, long = "tag")]
tags: Vec<String>,
#[arg(short, long)]
due: Option<String>,
#[arg(long)]
dir: Option<String>,
#[arg(long)]
template: Option<String>,
},
Template {
#[command(subcommand)]
command: TemplateCommand,
},
List {
#[arg(long)]
dir: Option<String>,
#[arg(short, long)]
status: Option<String>,
#[arg(short, long)]
tag: Option<String>,
#[arg(short, long)]
priority: Option<String>,
#[arg(long)]
due_before: Option<String>,
#[arg(long)]
due_after: Option<String>,
#[arg(short, long)]
quiet: bool,
},
Adopt {
paths: Vec<String>,
#[arg(long)]
all: bool,
#[arg(long)]
dry_run: bool,
#[arg(long)]
rename: bool,
},
Search {
query: String,
#[arg(short, long)]
status: Option<String>,
#[arg(short, long)]
tag: Option<String>,
},
Tag {
#[command(subcommand)]
command: TagCommand,
},
Show { id: String },
Delete {
id: String,
#[arg(short, long)]
force: bool,
},
Start { id: String },
Done { id: String },
Cancel { id: String },
Status { id: String, status: String },
Set {
id: String,
#[arg(long)]
title: Option<String>,
#[arg(long)]
priority: Option<String>,
#[arg(long)]
due: Option<String>,
#[arg(long = "tag-add")]
tag_add: Vec<String>,
#[arg(long = "tag-remove")]
tag_remove: Vec<String>,
},
Step {
#[command(subcommand)]
command: StepCommand,
},
Board {
#[arg(long)]
dir: Option<String>,
#[arg(short, long)]
tag: Option<String>,
#[arg(long)]
columns: Option<String>,
},
Remind {
#[arg(long)]
within: Option<String>,
#[arg(long)]
overdue: bool,
#[arg(long)]
summary: bool,
},
Overdue,
Stats,
Completions { shell: String },
FixNames {
#[arg(long)]
dry_run: bool,
},
Edit {
id: Option<String>,
#[arg(long)]
editor: Option<String>,
#[arg(long = "lib")]
lib: bool,
},
}
#[derive(Subcommand)]
pub enum TemplateCommand {
List,
Show { name: String },
New {
name: String,
#[arg(long)]
lib: bool,
#[arg(long)]
editor: Option<String>,
},
Edit {
name: String,
#[arg(long)]
editor: Option<String>,
},
Remove { name: String },
}
#[derive(Subcommand)]
pub enum StepCommand {
Add { id: String, title: String },
Done { id: String, step: String },
Remove { id: String, step: String },
}
#[derive(Subcommand)]
pub enum TagCommand {
Add {
id: String,
#[arg(required = true)]
tags: Vec<String>,
},
Remove {
id: String,
#[arg(required = true)]
tags: Vec<String>,
},
List,
}
#[derive(Subcommand)]
pub enum LibCommand {
Add { name: String, path: PathBuf },
List,
Use { name: String },
Current,
Remove { name: String },
}