aboutsummaryrefslogtreecommitdiffstats
path: root/atuin-common
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@elliehuxtable.com>2024-04-03 10:19:24 +0100
committerGitHub <noreply@github.com>2024-04-03 10:19:24 +0100
commit894eaa6faff86e1839510e114427b949b2440d39 (patch)
tree7bbda2eebb75b79292f3095017c44ebc97387654 /atuin-common
parentfeat: add 'ctrl-a a' to jump to beginning of line (#1917) (diff)
downloadatuin-894eaa6faff86e1839510e114427b949b2440d39.zip
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
Diffstat (limited to 'atuin-common')
-rw-r--r--atuin-common/src/utils.rs8
1 files changed, 8 insertions, 0 deletions
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") {