1#![deny(missing_docs)]
2
3use std::path::PathBuf;
4
5use clap::{Args, Parser, Subcommand};
6
7#[derive(Parser, Debug)]
9#[command(author, version, about, long_about = None)]
10pub struct Cli {
11 #[command(subcommand)]
13 pub op: Option<Op>,
14}
15
16#[derive(Subcommand, Debug)]
18pub enum Op {
19 List(ListArg),
21
22 Add(AddArg),
24
25 Done,
27
28 Edit(EditArg),
30
31 Delete(DeleteArg),
33}
34
35#[derive(Debug, Default, Args)]
37pub struct ListArg {
38 #[arg(short, long)]
40 output: Option<bool>,
41
42 #[arg(short)]
44 number: Option<usize>,
45}
46
47#[derive(Args, Debug)]
49pub struct AddArg {
50 pub title: String,
52
53 #[arg(short, long, requires = "title")]
55 pub description: Option<String>,
56}
57
58#[derive(Debug, Args)]
60pub struct EditArg {
61 pub id: i64,
63
64 #[arg(short, long)]
66 pub title: Option<String>,
67
68 #[arg(short, long)]
70 pub description: Option<String>,
71}
72
73#[derive(Debug, Args)]
75pub struct DeleteArg {
76 pub id: i64,
78}
79
80#[cfg(test)]
83mod tests {
84 use super::*;
85
86 #[test]
87 fn verify_cli() {
88 use clap::CommandFactory;
89 Cli::command().debug_assert();
90 }
91}
92
93