ajeetdsouza / zoxide

A smarter cd command. Supports all major shells.
MIT License
20.33k stars 519 forks source link

Manual command to prune the database #759

Closed GeigerJ2 closed 3 months ago

GeigerJ2 commented 3 months ago

Hello! Loving zoxide so far, great tool, thank you! :rocket:

Like in issue #269 (and related #105), I was also wondering about the existence of a manual command to prune the database that removes nonexistent paths.

To provide a possible use case: I quite regularly create git worktrees to work on certain issues, and delete them afterward once they are resolved. Currently, the directories still pop-up as suggestions for 90 days before being removed, so it would be nice to have that command to be able to clean things up a bit faster. I guess it could just be a simple loop over all directories, and delete the db entries if they don't exist?

Cheers!

ajeetdsouza commented 3 months ago

Directories that have been deleted should not show up in your query results at all. Where are you seeing these suggestions?

GeigerJ2 commented 3 months ago

Dang, seems like I've been using https://github.com/jethrokuan/z in my fish shell setup all along :smiling_face_with_tear: and after removing it, the functionality does not actually work.

Not sure where it goes wrong, as I have zoxide installed, zoxide init fish | source in my config, and type z actually returns:

╰─>$ type z
z is a function with definition
# Defined via `source`
function z --wraps=__zoxide_z --description 'alias z=__zoxide_z'
  __zoxide_z $argv

end

Think it's time to clean the setup a bit. If deleted directories aren't shown, that fixes my initial issue. Thanks for the clarification!

ajeetdsouza commented 3 months ago

Awesome, closing this issue.