jumprs

Crates.iojumprs
lib.rsjumprs
version0.1.0
created_at2026-01-05 05:32:16.793274+00
updated_at2026-01-05 05:32:16.793274+00
descriptionUnified API for reading directory jumper databases (zoxide, z, autojump, fasd)
homepage
repositoryhttps://github.com/thrashr888/jumprs
max_upload_size
id2023174
size40,557
Paul Thrasher (thrashr888)

documentation

README

jumprs

Unified Rust API for reading and writing directory jumper databases.

Crates.io Documentation License: MIT

Supported Directory Jumpers

Tool Database Location Format
zoxide ~/.local/share/zoxide/db.zo path|rank|timestamp
z ~/.z path|rank|timestamp
autojump ~/.local/share/autojump/autojump.txt rank\tpath
fasd ~/.fasd path|rank|timestamp

Installation

[dependencies]
jumprs = "0.1"

Quick Start

use jumprs::Database;

// Auto-detect the first available database
let db = Database::detect().expect("no jump database found");

// Search for directories matching a query
let results = db.search("proj");
for entry in results.iter().take(5) {
    println!("{}: {:.0}", entry.path.display(), entry.frecency());
}

// Get the best match
if let Some(best) = db.best_match("proj") {
    println!("Best match: {}", best.path.display());
}

Recording Visits

use jumprs::{Database, Backend};
use std::path::PathBuf;

// Load or create a database
let mut db = Database::with_backend(Backend::Z).unwrap();

// Record a directory visit (updates rank and timestamp)
db.add_visit(PathBuf::from("/home/user/projects"));

// Save changes to disk
db.save().expect("failed to save database");

Specifying a Backend

use jumprs::{Database, Backend};

// Use a specific backend
let db = Database::with_backend(Backend::Z).expect("z database not found");

// Get top directories by frecency
for entry in db.top_dirs(10) {
    println!("{}", entry.path.display());
}

// Check which backend was detected
println!("Using backend: {:?}", db.backend());

API Overview

Database Methods

Method Description
detect() Auto-detect and load the first available database
with_backend(backend) Load a specific backend's database
new(backend) Create an empty database
search(query) Search for directories matching query terms
best_match(query) Get the highest-frecency match
top_dirs(n) Get top N directories by frecency
add_visit(path) Record a visit to a directory
remove(path) Remove a directory from the database
clean() Remove directories that no longer exist
save() Save changes to disk

Backend Detection Priority

When using Backend::Auto, jumprs checks for databases in this order:

  1. zoxide
  2. z
  3. autojump
  4. fasd

The first available database is used.

MIT License

Copyright 2026 Paul Thrasher

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Commit count: 0

cargo fmt