1use crate::constants;
2use clap::{Parser, Subcommand};
3
4#[derive(Parser, Debug)]
6#[command(name = "j", version = constants::VERSION, about = "快捷命令行工具", long_about = None)]
7#[command(disable_help_subcommand = true)]
8pub struct Cli {
9 #[command(subcommand)]
10 pub command: Option<SubCmd>,
11
12 #[arg(trailing_var_arg = true, allow_hyphen_values = true)]
14 pub args: Vec<String>,
15}
16
17#[derive(Subcommand, Debug)]
18pub enum SubCmd {
19 #[command(alias = "s")]
22 Set {
23 alias: String,
25 #[arg(trailing_var_arg = true, allow_hyphen_values = true)]
27 path: Vec<String>,
28 },
29
30 #[command(alias = "rm")]
32 Remove {
33 alias: String,
35 },
36
37 #[command(alias = "rn")]
39 Rename {
40 alias: String,
42 new_alias: String,
44 },
45
46 #[command(alias = "mf")]
48 Modify {
49 alias: String,
51 #[arg(trailing_var_arg = true, allow_hyphen_values = true)]
53 path: Vec<String>,
54 },
55
56 #[command(alias = "nt")]
59 Note {
60 alias: String,
62 category: String,
64 },
65
66 #[command(alias = "dnt")]
68 Denote {
69 alias: String,
71 category: String,
73 },
74
75 #[command(alias = "ls")]
78 List {
79 part: Option<String>,
81 },
82
83 #[command(alias = "find")]
85 Contain {
86 alias: String,
88 containers: Option<String>,
90 },
91
92 #[command(aliases = ["r"])]
95 Report {
96 #[arg(trailing_var_arg = true, allow_hyphen_values = true)]
98 content: Vec<String>,
99 },
100
101 #[command(name = "reportctl", alias = "rctl")]
103 Reportctl {
104 action: String,
106 arg: Option<String>,
108 },
109
110 #[command(alias = "c")]
112 Check {
113 line_count: Option<String>,
115 },
116
117 #[command(aliases = ["select", "look", "sch"])]
119 Search {
120 line_count: String,
122 target: String,
124 #[arg(allow_hyphen_values = true)]
126 fuzzy: Option<String>,
127 },
128
129 #[command(alias = "td")]
132 Todo {
133 #[arg(trailing_var_arg = true, allow_hyphen_values = true)]
135 content: Vec<String>,
136 },
137
138 #[command(alias = "ai")]
141 Chat {
142 #[arg(trailing_var_arg = true, allow_hyphen_values = true)]
144 content: Vec<String>,
145 },
146
147 Concat {
150 name: String,
152 #[arg(trailing_var_arg = true, allow_hyphen_values = true)]
154 content: Vec<String>,
155 },
156
157 Time {
160 function: String,
162 arg: String,
164 },
165
166 Log {
169 key: String,
171 value: String,
173 },
174
175 #[command(alias = "chg")]
177 Change {
178 part: String,
180 field: String,
182 value: String,
184 },
185
186 #[command(alias = "cls")]
188 Clear,
189
190 #[command(alias = "v")]
193 Version,
194
195 #[command(alias = "h")]
197 Help,
198
199 #[command(aliases = ["q", "quit"])]
201 Exit,
202
203 #[command(alias = "vc")]
206 Voice {
207 #[arg(default_value = "")]
209 action: String,
210 #[arg(short = 'c', long = "copy")]
212 copy: bool,
213 #[arg(short = 'm', long = "model")]
215 model: Option<String>,
216 },
217
218 Completion {
220 shell: Option<String>,
222 },
223}