-
Notifications
You must be signed in to change notification settings - Fork 557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Automatic Backup and Recovery for db.zo #807
Comments
First problem that would need to be addressed is just importing Zoxide's own format (#591). For PowerShell users, the workaround that I have been using is querying the entire database, converting to an object, formatting the object to a string array to match the format of Z/Autojump, and then writing that to a file. From here, it would be up to the user on how they would want to handle their backups. |
@josephwhite Even though we don't have the final format for db.zo, zoxide could still back it up. Maybe make a copy named db.zo.bak. If there's a problem occurred for loading db.zo, zoxide could try to use the backup or just tell user themselves to recovery it. This way, users won't lose their data, and it doesn't depend on a specific data format. What do you think? |
I have a temporary workaround of making a copy of db.zo named db.zo.bak every time I call zoxide success, by configure the command z's behavior. |
Hi @hoofcushion can you share your WAR here? |
@wswslzp Here's my if test -n $(command -v zoxide); then
eval "$(zoxide init $(basename $SHELL))"
function back() {
local command="$1"
shift
"${command}" "$@"
if [ $? -eq 0 ]; then
cp "$HOME/.local/share/zoxide/db.zo" "$HOME/.local/share/zoxide/db.zo.bak"
fi
}
alias cd='back z'
alias cdi='back zi'
fi And what does WAR means? |
Thanks for your sharing 🙂
…________________________________
发件人: HC ***@***.***>
发送时间: 2024年5月15日 22:22
收件人: ajeetdsouza/zoxide ***@***.***>
抄送: wswslzp ***@***.***>; Mention ***@***.***>
主题: Re: [ajeetdsouza/zoxide] Feature Request: Automatic Backup and Recovery for db.zo (Issue #807)
@wswslzp<https://github.com/wswslzp> Here's my ~/.bashrc
if test -n $(command -v zoxide); then
eval "$(zoxide init $(basename $SHELL))"
function back() {
local command="$1"
shift
"${command}" "$@"
if [ $? -eq 0 ]; then
cp "$HOME/.local/share/zoxide/db.zo" "$HOME/.local/share/zoxide/db.zo.bak"
fi
}
alias cd='back z'
alias cdi='back zi'
fi
—
Reply to this email directly, view it on GitHub<#807 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHHK5JJC2SZF5EA6K5PQGTLZCNVQ3AVCNFSM6AAAAABHCXVNZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJSGY4DKNJTHE>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I encountered an issue with zoxide where I had to delete db.zo due to a database file corruption error: zoxide: unsupported version (got 0, supports 3).
That will fix the error, but all data are lost, so I have to type all of the file path again.
It would be helpful if zoxide could automatically create backups of db.zo and have a recovery option for corrupted or incompatible database files.
This feature would improve the resilience of the tool and save users from manual intervention in case of database errors.
Thank you for considering this request.
The text was updated successfully, but these errors were encountered: