1pub const VERSION: &str = env!("CARGO_PKG_VERSION");
8
9pub const APP_NAME: &str = "work-copilot";
11
12pub const AUTHOR: &str = "lingojack";
14
15pub const EMAIL: &str = "lingojack@qq.com";
17
18pub const GITHUB_REPO: &str = "LingoJack/j";
20
21pub const GITHUB_RELEASES_API: &str = "https://api.github.com/repos/LingoJack/j/releases/latest";
23
24pub const VERSION_CHECK_CACHE_FILE: &str = "version_check.json";
26
27pub const VERSION_CHECK_INTERVAL_SECS: u64 = 24 * 60 * 60;
29
30pub mod section {
34 pub const PATH: &str = "path";
35 pub const INNER_URL: &str = "inner_url";
36 pub const OUTER_URL: &str = "outer_url";
37 pub const EDITOR: &str = "editor";
38 pub const BROWSER: &str = "browser";
39 pub const VPN: &str = "vpn";
40 pub const SCRIPT: &str = "script";
41 pub const VERSION: &str = "version";
42 pub const SETTING: &str = "setting";
43 pub const LOG: &str = "log";
44 pub const REPORT: &str = "report";
45}
46
47pub const ALL_SECTIONS: &[&str] = &[
49 section::PATH,
50 section::INNER_URL,
51 section::OUTER_URL,
52 section::EDITOR,
53 section::BROWSER,
54 section::VPN,
55 section::SCRIPT,
56 section::VERSION,
57 section::SETTING,
58 section::LOG,
59 section::REPORT,
60];
61
62pub const DEFAULT_DISPLAY_SECTIONS: &[&str] = &[
64 section::PATH,
65 section::INNER_URL,
66 section::OUTER_URL,
67 section::EDITOR,
68 section::BROWSER,
69 section::VPN,
70 section::SCRIPT,
71];
72
73pub const CONTAIN_SEARCH_SECTIONS: &[&str] = &[
75 section::PATH,
76 section::SCRIPT,
77 section::BROWSER,
78 section::EDITOR,
79 section::VPN,
80 section::INNER_URL,
81 section::OUTER_URL,
82];
83
84pub const NOTE_CATEGORIES: &[&str] = &[
88 section::BROWSER,
89 section::EDITOR,
90 section::VPN,
91 section::OUTER_URL,
92 section::SCRIPT,
93];
94
95pub const ALIAS_PATH_SECTIONS: &[&str] = &[
99 section::PATH,
100 section::INNER_URL,
101 section::OUTER_URL,
102];
103
104pub const ALIAS_EXISTS_SECTIONS: &[&str] = &[
106 section::PATH,
107 section::INNER_URL,
108 section::OUTER_URL,
109 section::SCRIPT,
110 section::BROWSER,
111 section::EDITOR,
112 section::VPN,
113];
114
115pub const MODIFY_SECTIONS: &[&str] = &[
117 section::PATH,
118 section::INNER_URL,
119 section::OUTER_URL,
120 section::EDITOR,
121 section::BROWSER,
122 section::VPN,
123];
124
125pub const REMOVE_CLEANUP_SECTIONS: &[&str] = &[
127 section::EDITOR,
128 section::VPN,
129 section::BROWSER,
130 section::SCRIPT,
131];
132
133pub const RENAME_SYNC_SECTIONS: &[&str] = &[
135 section::BROWSER,
136 section::EDITOR,
137 section::VPN,
138 section::SCRIPT,
139];
140
141pub mod config_key {
145 pub const MODE: &str = "mode";
146 pub const VERBOSE: &str = "verbose";
147 pub const CONCISE: &str = "concise";
148 pub const SEARCH_ENGINE: &str = "search-engine";
149 pub const WEEK_REPORT: &str = "week_report";
150 pub const WEEK_NUM: &str = "week_num";
151 pub const LAST_DAY: &str = "last_day";
152 pub const GIT_REPO: &str = "git_repo";
153}
154
155pub const DEFAULT_SEARCH_ENGINE: &str = "bing";
159
160pub mod search_engine {
162 pub const GOOGLE: &str = "https://www.google.com/search?q={}";
163 pub const BING: &str = "https://www.bing.com/search?q={}";
164 pub const BAIDU: &str = "https://www.baidu.com/s?wd={}";
165}
166
167pub const REPORT_DATE_FORMAT: &str = "%Y.%m.%d";
171
172pub const REPORT_SIMPLE_DATE_FORMAT: &str = "%Y/%m/%d";
174
175pub const DEFAULT_CHECK_LINES: usize = 5;
177
178pub mod cmd {
183 pub const SET: &[&str] = &["set", "s"];
185 pub const REMOVE: &[&str] = &["rm", "remove"];
186 pub const RENAME: &[&str] = &["rename", "rn"];
187 pub const MODIFY: &[&str] = &["mf", "modify"];
188
189 pub const NOTE: &[&str] = &["note", "nt"];
191 pub const DENOTE: &[&str] = &["denote", "dnt"];
192
193 pub const LIST: &[&str] = &["ls", "list"];
195 pub const CONTAIN: &[&str] = &["contain", "find"];
196
197 pub const REPORT: &[&str] = &["report", "r"];
199 pub const REPORTCTL: &[&str] = &["reportctl", "rctl"];
200 pub const CHECK: &[&str] = &["check", "c"];
201 pub const SEARCH: &[&str] = &["search", "select", "look", "sch"];
202
203 pub const CONCAT: &[&str] = &["concat"];
205
206 pub const TIME: &[&str] = &["time"];
208
209 pub const LOG: &[&str] = &["log"];
211 pub const CHANGE: &[&str] = &["change", "chg"];
212 pub const CLEAR: &[&str] = &["clear", "cls"];
213
214 pub const VERSION: &[&str] = &["version", "v"];
216 pub const HELP: &[&str] = &["help", "h"];
217 pub const EXIT: &[&str] = &["exit", "q", "quit"];
218
219 pub const COMPLETION: &[&str] = &["completion"];
221
222 pub const AGENT: &[&str] = &["agent"];
224 pub const SYSTEM: &[&str] = &["system", "ps"];
225
226 pub fn all_keywords() -> Vec<&'static str> {
228 let groups: &[&[&str]] = &[
229 SET, REMOVE, RENAME, MODIFY,
230 NOTE, DENOTE,
231 LIST, CONTAIN,
232 REPORT, REPORTCTL, CHECK, SEARCH,
233 CONCAT, TIME,
234 LOG, CHANGE, CLEAR,
235 VERSION, HELP, EXIT,
236 COMPLETION,
237 AGENT, SYSTEM,
238 ];
239 groups.iter().flat_map(|g| g.iter().copied()).collect()
240 }
241}
242
243pub mod rmeta_action {
246 pub const NEW: &str = "new";
247 pub const SYNC: &str = "sync";
248 pub const PUSH: &str = "push";
249 pub const PULL: &str = "pull";
250 pub const SET_URL: &str = "set-url";
251 pub const OPEN: &str = "open";
252}
253
254pub mod time_function {
257 pub const COUNTDOWN: &str = "countdown";
258}
259
260pub mod search_flag {
263 pub const FUZZY_SHORT: &str = "-f";
264 pub const FUZZY: &str = "-fuzzy";
265}
266
267pub const LIST_ALL: &str = "all";
270
271pub const WELCOME_MESSAGE: &str = "Welcome to use work copilot 🚀 ~";
275
276pub const SHELL_PREFIX: char = '!';
278
279pub const INTERACTIVE_PROMPT: &str = "copilot >";
281
282pub const HISTORY_FILE: &str = "history.txt";
284
285pub const CONFIG_FILE: &str = "config.yaml";
287
288pub const SCRIPTS_DIR: &str = "scripts";
290
291pub const REPORT_DIR: &str = "report";
293
294pub const REPORT_DEFAULT_FILE: &str = "week_report.md";
296
297pub const DATA_DIR: &str = ".jdata";
299
300pub const DATA_PATH_ENV: &str = "J_DATA_PATH";
302
303pub mod shell {
306 pub const BASH_PATH: &str = "/bin/bash";
307 pub const WINDOWS_CMD: &str = "cmd";
308 pub const WINDOWS_CMD_FLAG: &str = "/c";
309 pub const BASH_CMD_FLAG: &str = "-c";
310 pub const WINDOWS_OS: &str = "windows";
311 pub const MACOS_OS: &str = "macos";
312}