From 894eaa6faff86e1839510e114427b949b2440d39 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Wed, 3 Apr 2024 10:19:24 +0100 Subject: perf(dotfiles): cache aliases and read straight from file (#1918) * cache aliases when set locally * handle rebuild on sync and tidy things a bit * support all shells except nu * make clippy happy * fmt * fix for no features --- atuin-common/src/utils.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'atuin-common/src') diff --git a/atuin-common/src/utils.rs b/atuin-common/src/utils.rs index 1e0f5a9a..7c533663 100644 --- a/atuin-common/src/utils.rs +++ b/atuin-common/src/utils.rs @@ -75,6 +75,14 @@ pub fn data_dir() -> PathBuf { data_dir.join("atuin") } +pub fn dotfiles_cache_dir() -> PathBuf { + // In most cases, this will be ~/.local/share/atuin/dotfiles/cache + let data_dir = std::env::var("XDG_DATA_HOME") + .map_or_else(|_| home_dir().join(".local").join("share"), PathBuf::from); + + data_dir.join("atuin").join("dotfiles").join("cache") +} + pub fn get_current_dir() -> String { // Prefer PWD environment variable over cwd if available to better support symbolic links match env::var("PWD") { -- cgit v1.3.1