pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub const APP_NAME: &str = "j-cli";
pub const AUTHOR: &str = "lingojack";
pub const EMAIL: &str = "lingojack@qq.com";
pub const INSTALL_SOURCE: &str = match option_env!("INSTALL_SOURCE") {
Some(s) => s,
None => "cargo",
};
pub const CONFIG_FIELDS: &[&str] = &["name", "api_base", "api_key", "model", "supports_vision"];
#[allow(dead_code)]
pub const CONFIG_GLOBAL_FIELDS: &[&str] = &[
"system_prompt",
"style",
"max_history_messages",
"theme",
"tools_enabled",
"max_tool_rounds",
"tool_confirm_timeout",
"skills_enabled",
];
pub const CONFIG_GLOBAL_FIELDS_TAB: &[&str] = &[
"system_prompt",
"style",
"max_history_messages",
"theme",
"max_tool_rounds",
"tool_confirm_timeout",
"auto_restore_session",
];
pub const TOAST_DURATION_SECS: u64 = 4;
pub mod section {
pub const PATH: &str = "path";
pub const INNER_URL: &str = "inner_url";
pub const OUTER_URL: &str = "outer_url";
pub const EDITOR: &str = "editor";
pub const BROWSER: &str = "browser";
pub const VPN: &str = "vpn";
pub const SCRIPT: &str = "script";
pub const VERSION: &str = "version";
pub const SETTING: &str = "setting";
pub const LOG: &str = "log";
pub const REPORT: &str = "report";
}
pub const ALL_SECTIONS: &[&str] = &[
section::PATH,
section::INNER_URL,
section::OUTER_URL,
section::EDITOR,
section::BROWSER,
section::VPN,
section::SCRIPT,
section::VERSION,
section::SETTING,
section::LOG,
section::REPORT,
];
pub const DEFAULT_DISPLAY_SECTIONS: &[&str] = &[
section::PATH,
section::INNER_URL,
section::OUTER_URL,
section::EDITOR,
section::BROWSER,
section::VPN,
section::SCRIPT,
];
pub const CONTAIN_SEARCH_SECTIONS: &[&str] = &[
section::PATH,
section::SCRIPT,
section::BROWSER,
section::EDITOR,
section::VPN,
section::INNER_URL,
section::OUTER_URL,
];
pub const NOTE_CATEGORIES: &[&str] = &[
section::BROWSER,
section::EDITOR,
section::VPN,
section::OUTER_URL,
section::SCRIPT,
];
pub const ALIAS_PATH_SECTIONS: &[&str] = &[section::PATH, section::INNER_URL, section::OUTER_URL];
pub const ALIAS_EXISTS_SECTIONS: &[&str] = &[
section::PATH,
section::INNER_URL,
section::OUTER_URL,
section::SCRIPT,
section::BROWSER,
section::EDITOR,
section::VPN,
];
pub const MODIFY_SECTIONS: &[&str] = &[
section::PATH,
section::INNER_URL,
section::OUTER_URL,
section::EDITOR,
section::BROWSER,
section::VPN,
];
pub const REMOVE_CLEANUP_SECTIONS: &[&str] = &[
section::EDITOR,
section::VPN,
section::BROWSER,
section::SCRIPT,
];
pub const RENAME_SYNC_SECTIONS: &[&str] = &[
section::BROWSER,
section::EDITOR,
section::VPN,
section::SCRIPT,
];
pub mod config_key {
pub const MODE: &str = "mode";
pub const VERBOSE: &str = "verbose";
pub const CONCISE: &str = "concise";
pub const SEARCH_ENGINE: &str = "search-engine";
pub const WEEK_REPORT: &str = "week_report";
pub const WEEK_NUM: &str = "week_num";
pub const LAST_DAY: &str = "last_day";
pub const GIT_REPO: &str = "git_repo";
#[cfg_attr(not(feature = "browser_cdp"), allow(dead_code))]
pub const BROWSER_HEADLESS: &str = "browser_headless";
pub const NOTEBOOK_PANEL_RATIO: &str = "notebook_panel_ratio";
pub const NOTEBOOK_EXPANDED_DIRS: &str = "notebook_expanded_dirs";
}
pub const DEFAULT_SEARCH_ENGINE: &str = "bing";
pub const NEW_WINDOW_FLAG: &str = "-w";
pub const NEW_WINDOW_FLAG_LONG: &str = "--new-window";
pub mod search_engine {
pub const GOOGLE: &str = "https://www.google.com/search?q={}";
pub const BING: &str = "https://www.bing.com/search?q={}";
pub const BAIDU: &str = "https://www.baidu.com/s?wd={}";
}
pub const REPORT_DATE_FORMAT: &str = "%Y.%m.%d";
pub const REPORT_SIMPLE_DATE_FORMAT: &str = "%Y/%m/%d";
pub const DEFAULT_CHECK_LINES: usize = 10;
pub mod cmd {
pub const SET: &[&str] = &["set", "s"];
pub const REMOVE: &[&str] = &["rm", "remove"];
pub const RENAME: &[&str] = &["rename", "rn"];
pub const MODIFY: &[&str] = &["mf", "modify"];
pub const TAG: &[&str] = &["tag", "t"];
pub const UNTAG: &[&str] = &["untag", "ut"];
pub const LIST: &[&str] = &["ls", "list"];
pub const CONTAIN: &[&str] = &["contain", "find"];
pub const REPORT: &[&str] = &["report", "r"];
pub const REPORTCTL: &[&str] = &["reportctl", "rctl"];
pub const CHECK: &[&str] = &["check", "c"];
pub const SEARCH: &[&str] = &["search", "select", "look", "sch"];
pub const TODO: &[&str] = &["todo", "td"];
pub const SCRIPT: &[&str] = &["script", "sc"];
pub const TIME: &[&str] = &["time"];
pub const LOG: &[&str] = &["log"];
pub const CONFIG: &[&str] = &["config", "cfg"];
pub const CLEAR: &[&str] = &["clear", "cls"];
pub const VERSION: &[&str] = &["version", "v"];
pub const HELP: &[&str] = &["help", "h"];
pub const EXIT: &[&str] = &["exit", "q", "quit"];
pub const COMPLETION: &[&str] = &["completion"];
pub const CHAT: &[&str] = &["chat", "ai"];
pub const AGENT: &[&str] = &["agent"];
pub const SYSTEM: &[&str] = &["system", "ps"];
pub const UPDATE: &[&str] = &["update", "up"];
pub const MD: &[&str] = &["md", "markdown"];
pub const NOTEBOOK: &[&str] = &["notebook", "nb"];
pub fn all_keywords() -> Vec<&'static str> {
let groups: &[&[&str]] = &[
SET, REMOVE, RENAME, MODIFY, TAG, UNTAG, LIST, CONTAIN, REPORT, REPORTCTL, CHECK,
SEARCH, TODO, CHAT, SCRIPT, TIME, LOG, CONFIG, CLEAR, VERSION, HELP, EXIT, COMPLETION,
AGENT, SYSTEM, UPDATE, MD, NOTEBOOK,
];
groups.iter().flat_map(|g| g.iter().copied()).collect()
}
}
pub mod rmeta_action {
pub const NEW: &str = "new";
pub const SYNC: &str = "sync";
pub const PUSH: &str = "push";
pub const PULL: &str = "pull";
pub const SET_URL: &str = "set-url";
pub const OPEN: &str = "open";
}
pub mod notebook_action {
pub const LIST: &str = "list";
pub const SEARCH: &str = "search";
pub const DELETE: &str = "delete";
pub const OPEN: &str = "open";
pub const RENAME: &str = "rename";
pub const MKDIR: &str = "mkdir";
pub const MV: &str = "mv";
}
pub mod time_function {
pub const COUNTDOWN: &str = "countdown";
}
pub mod search_flag {
pub const FUZZY_SHORT: &str = "-f";
pub const FUZZY: &str = "-fuzzy";
}
pub const LIST_ALL: &str = "all";
pub const WELCOME_MESSAGE: &str = r###"
╔═══════════════════════════════════════════════════════════════════════════╗
║ ║
║ ██╗ ██████╗ ██╗ ██╗ ║
║ ██║ ██╔════╝ ██║ ██║ ║
║ ██║ █████╗██║ ██║ ██║ ║
║ ██ ██║ ╚════╝██║ ██║ ██║ ║
║ ╚█████╔╝ ╚██████╗ ███████╗ ██║ ║
║ ╚════╝ ╚═════╝ ╚══════╝ ╚═╝ ║
║ ║
╠═══════════════════════════════════════════════════════════════════════════╣
║ ║
║ 💻 Recommended Terminal: Kitty ║
║ https://sw.kovidgoyal.net/kitty ║
║ ║
║ 🎨 Recommended Theme: ║
║ https://github.com/LingoJack/kitty_conf ║
║ ║
║ 🚉 Github Repo: ║
║ https://github.com/LingoJack/j.git ║
║ ║
╠═══════════════════════════════════════════════════════════════════════════╣
║ ║
║ 📦 Quick Setup: ║
║ ║
║ 1. Install Kitty ║
║ curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh ║
║ ║
║ 2. Apply Theme ║
║ cd ~/.config/kitty && ║
║ git clone github.com/LingoJack/kitty_conf . ║
║ ║
║ 3. Reload Kitty ║
║ ║
╚═══════════════════════════════════════════════════════════════════════════╝
"###;
pub const SHELL_PREFIX_EN: char = '!';
pub const SHELL_PREFIX_CN: char = '!';
pub const INTERACTIVE_PROMPT: &str = "j >";
pub const HISTORY_FILE: &str = "history.txt";
pub const CONFIG_FILE: &str = "config.yaml";
pub const SCRIPTS_DIR: &str = "scripts";
pub const REPORT_DIR: &str = "report";
pub const NOTEBOOK_DIR: &str = "notebook";
pub const AGENT_DIR: &str = "agent";
pub const AGENT_LOG_DIR: &str = "logs";
pub const AGENT_LOG_INFO: &str = "info.log";
pub const AGENT_LOG_ERROR: &str = "error.log";
pub const REPORT_DEFAULT_FILE: &str = "week_report.md";
pub const DATA_DIR: &str = ".jdata";
pub const DATA_PATH_ENV: &str = "J_DATA_PATH";
pub mod shell {
pub const BASH_PATH: &str = "/bin/bash";
pub const WINDOWS_CMD: &str = "cmd";
pub const WINDOWS_CMD_FLAG: &str = "/c";
pub const BASH_CMD_FLAG: &str = "-c";
pub const WINDOWS_OS: &str = "windows";
pub const MACOS_OS: &str = "macos";
}
pub mod todo_filter {
pub const ALL: usize = 0;
pub const UNDONE: usize = 1;
pub const DONE: usize = 2;
pub const COUNT: usize = 3;
pub fn label(filter: usize) -> &'static str {
match filter {
UNDONE => "未完成",
DONE => "已完成",
_ => "全部",
}
}
pub const DEFAULT: usize = UNDONE;
}