Histfile fallback

This commit is contained in:
Sage Vaillancourt 2024-02-24 13:38:43 -05:00
parent b0bc85b327
commit e659f1af3d
1 changed files with 5 additions and 2 deletions

View File

@ -132,10 +132,13 @@ function merge-hist {
}
function sync-history {
scp -P 11275 'sage@sagev.space:~/histfile' "/tmp/.histfile"
if ! scp -P 11275 'sage@sagev.space:~/histfile' "/tmp/.histfile"; then
scp -P 11275 "$HOME/.histfile" 'sage@sagev.space:~/histfile'
return
fi
merge-hist "$HOME/.histfile" "/tmp/.histfile" > "/tmp/$(whoami).histfile"
mv "/tmp/$(whoami).histfile" "$HOME/.histfile"
scp -P 11275 "$HOME/.histfile" "/tmp/$(whoami).histfile"
scp -P 11275 "$HOME/.histfile" 'sage@sagev.space:~/histfile'
}
function load-extensions {