1pub mod alias;
2pub mod category;
3pub mod chat;
4pub mod list;
5pub mod open;
6pub mod report;
7pub mod script;
8pub mod system;
9pub mod time;
10pub mod todo;
11pub mod voice;
12
13use crate::cli::SubCmd;
14use crate::config::YamlConfig;
15use crate::constants;
16
17pub fn all_command_keywords() -> Vec<&'static str> {
20 constants::cmd::all_keywords()
21}
22
23pub fn dispatch(subcmd: SubCmd, config: &mut YamlConfig) {
25 match subcmd {
26 SubCmd::Set { alias, path } => alias::handle_set(&alias, &path, config),
28 SubCmd::Remove { alias } => alias::handle_remove(&alias, config),
29 SubCmd::Rename { alias, new_alias } => alias::handle_rename(&alias, &new_alias, config),
30 SubCmd::Modify { alias, path } => alias::handle_modify(&alias, &path, config),
31
32 SubCmd::Note { alias, category } => category::handle_note(&alias, &category, config),
34 SubCmd::Denote { alias, category } => category::handle_denote(&alias, &category, config),
35
36 SubCmd::List { part } => list::handle_list(part.as_deref(), config),
38 SubCmd::Contain { alias, containers } => {
39 system::handle_contain(&alias, containers.as_deref(), config)
40 }
41
42 SubCmd::Report { content } => report::handle_report("report", &content, config),
44 SubCmd::Reportctl { action, arg } => {
45 let mut args = vec![action];
46 if let Some(a) = arg {
47 args.push(a);
48 }
49 report::handle_report("reportctl", &args, config);
50 }
51 SubCmd::Check { line_count } => report::handle_check(line_count.as_deref(), config),
52 SubCmd::Search {
53 line_count,
54 target,
55 fuzzy,
56 } => {
57 report::handle_search(&line_count, &target, fuzzy.as_deref(), config);
58 }
59
60 SubCmd::Todo { content } => todo::handle_todo(&content, config),
62
63 SubCmd::Chat { content } => chat::handle_chat(&content, config),
65
66 SubCmd::Concat { name, content } => script::handle_concat(&name, &content, config),
68
69 SubCmd::Time { function, arg } => time::handle_time(&function, &arg),
71
72 SubCmd::Log { key, value } => system::handle_log(&key, &value, config),
74 SubCmd::Change { part, field, value } => {
75 system::handle_change(&part, &field, &value, config)
76 }
77 SubCmd::Clear => system::handle_clear(),
78
79 SubCmd::Version => system::handle_version(config),
81 SubCmd::Help => system::handle_help(),
82 SubCmd::Exit => system::handle_exit(),
83 SubCmd::Completion { shell } => system::handle_completion(shell.as_deref(), config),
84
85 SubCmd::Voice {
87 action,
88 copy,
89 model,
90 } => voice::handle_voice(&action, copy, model.as_deref(), config),
91 }
92}