mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
bfcf77c9a2
commit
40c6da1ba8
4 changed files with 16 additions and 14 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -2694,6 +2694,7 @@ dependencies = [
|
||||||
"clap_complete_nushell",
|
"clap_complete_nushell",
|
||||||
"serde",
|
"serde",
|
||||||
"vergen",
|
"vergen",
|
||||||
|
"yazi-config",
|
||||||
"yazi-shared",
|
"yazi-shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ homepage = "https://yazi-rs.github.io"
|
||||||
repository = "https://github.com/sxyazi/yazi"
|
repository = "https://github.com/sxyazi/yazi"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
yazi-config = { path = "../yazi-config", version = "0.2.3" }
|
||||||
yazi-shared = { path = "../yazi-shared", version = "0.2.3" }
|
yazi-shared = { path = "../yazi-shared", version = "0.2.3" }
|
||||||
|
|
||||||
# External dependencies
|
# External dependencies
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ use std::{ffi::OsString, fs, path::{Path, PathBuf}, process};
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
use yazi_config::PREVIEW;
|
||||||
use yazi_shared::{fs::{current_cwd, expand_path}, Xdg};
|
use yazi_shared::{fs::{current_cwd, expand_path}, Xdg};
|
||||||
|
|
||||||
use super::Args;
|
use super::Args;
|
||||||
|
|
@ -67,6 +68,19 @@ impl Default for Args {
|
||||||
process::exit(0);
|
process::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if args.clear_cache {
|
||||||
|
if PREVIEW.cache_dir == Xdg::cache_dir() {
|
||||||
|
println!("Clearing cache directory: \n{:?}", PREVIEW.cache_dir);
|
||||||
|
fs::remove_dir_all(&PREVIEW.cache_dir).unwrap();
|
||||||
|
} else {
|
||||||
|
println!(
|
||||||
|
"You've changed the default cache directory, for your data's safety, please clear it manually: \n{:?}",
|
||||||
|
PREVIEW.cache_dir
|
||||||
|
);
|
||||||
|
}
|
||||||
|
process::exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
args
|
args
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,20 +56,6 @@ impl Default for Preview {
|
||||||
fs::create_dir(&cache_dir).unwrap();
|
fs::create_dir(&cache_dir).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: xx
|
|
||||||
// if ARGS.clear_cache {
|
|
||||||
// if cache_dir == Xdg::cache_dir() {
|
|
||||||
// println!("Clearing cache directory: \n{:?}", cache_dir);
|
|
||||||
// fs::remove_dir_all(&cache_dir).unwrap();
|
|
||||||
// } else {
|
|
||||||
// println!(
|
|
||||||
// "You've changed the default cache directory, for your data's safety, please
|
|
||||||
// clear it manually: \n{:?}", cache_dir
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// process::exit(0);
|
|
||||||
// }
|
|
||||||
|
|
||||||
Preview {
|
Preview {
|
||||||
tab_size: preview.tab_size,
|
tab_size: preview.tab_size,
|
||||||
max_width: preview.max_width,
|
max_width: preview.max_width,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue