aboutsummaryrefslogtreecommitdiffstats
path: root/crates/atuin-dotfiles/src/shell/fish.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-10 22:01:45 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-10 22:01:45 +0200
commit5e31a81cd2207f053b8cd8ad84ebe2a2f691b29d (patch)
tree5d76811ab0d693c01fa472d41aa2ceaf3bd0b415 /crates/atuin-dotfiles/src/shell/fish.rs
parentchore: Remove unneeded files (diff)
downloadatuin-5e31a81cd2207f053b8cd8ad84ebe2a2f691b29d.zip
chore: Remove some unused rust code
Diffstat (limited to 'crates/atuin-dotfiles/src/shell/fish.rs')
-rw-r--r--crates/atuin-dotfiles/src/shell/fish.rs69
1 files changed, 0 insertions, 69 deletions
diff --git a/crates/atuin-dotfiles/src/shell/fish.rs b/crates/atuin-dotfiles/src/shell/fish.rs
deleted file mode 100644
index 6d472f67..00000000
--- a/crates/atuin-dotfiles/src/shell/fish.rs
+++ /dev/null
@@ -1,69 +0,0 @@
-// Configuration for fish
-use std::path::PathBuf;
-
-use crate::store::{AliasStore, var::VarStore};
-
-async fn cached_aliases(path: PathBuf, store: &AliasStore) -> String {
- match tokio::fs::read_to_string(path).await {
- Ok(aliases) => aliases,
- Err(r) => {
- // we failed to read the file for some reason, but the file does exist
- // fallback to generating new aliases on the fly
-
- store.posix().await.unwrap_or_else(|e| {
- format!("echo 'Atuin: failed to read and generate aliases: \n{r}\n{e}'",)
- })
- }
- }
-}
-
-async fn cached_vars(path: PathBuf, store: &VarStore) -> String {
- match tokio::fs::read_to_string(path).await {
- Ok(vars) => vars,
- Err(r) => {
- // we failed to read the file for some reason, but the file does exist
- // fallback to generating new vars on the fly
-
- store.posix().await.unwrap_or_else(|e| {
- format!("echo 'Atuin: failed to read and generate vars: \n{r}\n{e}'",)
- })
- }
- }
-}
-
-/// Return fish dotfile config
-///
-/// Do not return an error. We should not prevent the shell from starting.
-///
-/// In the worst case, Atuin should not function but the shell should start correctly.
-///
-/// While currently this only returns aliases, it will be extended to also return other synced dotfiles
-pub async fn alias_config(store: &AliasStore) -> String {
- // First try to read the cached config
- let aliases = atuin_common::utils::dotfiles_cache_dir().join("aliases.fish");
-
- if aliases.exists() {
- return cached_aliases(aliases, store).await;
- }
-
- if let Err(e) = store.build().await {
- return format!("echo 'Atuin: failed to generate aliases: {e}'");
- }
-
- cached_aliases(aliases, store).await
-}
-
-pub async fn var_config(store: &VarStore) -> String {
- // First try to read the cached config
- let vars = atuin_common::utils::dotfiles_cache_dir().join("vars.fish");
-
- if vars.exists() {
- return cached_vars(vars, store).await;
- }
-
- if let Err(e) = store.build().await {
- return format!("echo 'Atuin: failed to generate vars: {e}'");
- }
-
- cached_vars(vars, store).await
-}