subx_cli/commands/
cache_command.rs1use crate::Result;
2use crate::cli::CacheArgs;
3use crate::error::SubXError;
4use dirs;
5
6pub async fn execute(args: CacheArgs) -> Result<()> {
8 match args.action {
9 crate::cli::CacheAction::Clear => {
10 let dir = dirs::config_dir().ok_or_else(|| SubXError::config("無法確定快取目錄"))?;
11 let path = dir.join("subx").join("match_cache.json");
12 if path.exists() {
13 std::fs::remove_file(&path)?;
14 println!("已清除快取檔案:{}", path.display());
15 } else {
16 println!("未發現快取檔案");
17 }
18 }
19 }
20 Ok(())
21}