Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 92 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ askama = { version = "0.14.0", default-features = false, features = [
"derive",
"std",
] }
bincode = "1.3.1"
rusqlite = "0.30.0"
clap = { version = "4.3.0", features = ["derive"] }
color-print = "0.3.4"
dirs = "6.0.0"
Expand Down
16 changes: 8 additions & 8 deletions src/cmd/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn import_autojump(db: &mut Database, buffer: &str) -> Result<()> {
// take a while to normalize.
rank = sigmoid(rank);

db.add_unchecked(path, rank, 0);
db.add_unchecked_merge(path, rank, 0);
}

if db.dirty() {
Expand All @@ -65,7 +65,7 @@ fn import_z(db: &mut Database, buffer: &str) -> Result<()> {

let path = split.next().with_context(|| format!("invalid entry: {line}"))?;

db.add_unchecked(path, rank, last_accessed);
db.add_unchecked_merge(path, rank, last_accessed);
}

if db.dirty() {
Expand Down Expand Up @@ -107,12 +107,12 @@ mod tests {
println!("got: {:?}", &db.dirs());

let exp = [
Dir { path: "/baz".into(), rank: sigmoid(7.0), last_accessed: 0 },
Dir { path: "/corge/grault/garply".into(), rank: 6.0, last_accessed: 600 },
Dir { path: "/foo/bar".into(), rank: 9.0 + sigmoid(2.0), last_accessed: 900 },
Dir { path: "/quux/quuz".into(), rank: 1.0 + sigmoid(5.0), last_accessed: 100 },
Dir { path: "/corge/grault/garply".into(), rank: 6.0, last_accessed: 600 },
Dir { path: "/waldo/fred/plugh".into(), rank: 3.0, last_accessed: 300 },
Dir { path: "/xyzzy/thud".into(), rank: 8.0, last_accessed: 800 },
Dir { path: "/foo/bar".into(), rank: 9.0 + sigmoid(2.0), last_accessed: 900 },
Dir { path: "/baz".into(), rank: sigmoid(7.0), last_accessed: 0 },
];
println!("exp: {exp:?}");

Expand Down Expand Up @@ -148,12 +148,12 @@ mod tests {
println!("got: {:?}", &db.dirs());

let exp = [
Dir { path: "/baz".into(), rank: 7.0, last_accessed: 700 },
Dir { path: "/corge/grault/garply".into(), rank: 6.0, last_accessed: 600 },
Dir { path: "/foo/bar".into(), rank: 11.0, last_accessed: 900 },
Dir { path: "/quux/quuz".into(), rank: 10.0, last_accessed: 500 },
Dir { path: "/corge/grault/garply".into(), rank: 6.0, last_accessed: 600 },
Dir { path: "/waldo/fred/plugh".into(), rank: 3.0, last_accessed: 300 },
Dir { path: "/xyzzy/thud".into(), rank: 8.0, last_accessed: 800 },
Dir { path: "/foo/bar".into(), rank: 11.0, last_accessed: 900 },
Dir { path: "/baz".into(), rank: 7.0, last_accessed: 700 },
];
println!("exp: {exp:?}");

Expand Down
Loading
Loading