or bm
for short because who doesn't like a good bm...
The purpose of this project is to create a cross-platform, CLI based, web bookmark manager in Rust that saves bookmarks to a flat file (CSV).
This has several advantages:
- It's not tied to any specific browser, so it is easier to switch back and forth between Firefox and Chrome over the years.
- Flat files are forever. Even if the tools built around them become deprecated so there is no concern of every losing data.
- Flat files play nicely with Git/SCM.
The intention is that the CSV file is stored in Git/SCM, and it can be synced between devices using Git/SCM.
The "CSV" file is actually |
separated with 3 columns: URL, DESCRIPTION, and TAGS. The TAGS column contains a comma separated list.
# If not using the --no-commit option, it will use the default user/email for creating commits when new bookmarks are added
git config --global user.name <name>
git config --global user.email <email>
Requires installing Rust.
# Installs to ~/.cargo/bin which should be in your path if you installed Rust according to the standard instructions.
cargo install --path .
Indicate where the application should look for the CSV file either with the BOOKMARK_MANAGER_CSV
environmental variable.
# In .bashrc
export BOOKMARK_MANAGER_CSV=<path>
or
# When running the application
BOOKMARK_MANAGER_CSV=<path> bm ...
The CSV will be created if it does not exist at the given path.
bm help
bm help add
bm add <URL> <DESCRIPTION>
bm a <URL> <DESCRIPTION>
# URLs are validated and must begin with http(s)
bm a https://www.google.com "Google search engine" -t Search --tag Google
bm add https://www.facebook.com "Time sink"
# By default, if BOOKMARK_MANAGER_CSV is in a git repo. A commit will be made after adding a new bookmark. --no-commit to turn off
bm add https://github.com "Source code" --no-commit
bm help add
bm search <REGEX>
bm s <REGEX>
# Search with only regex, no tags
# The regex is case insensitive
bm search "search engine"
# Tags are like "and" queries
# Tags are case insensitive
bm s google --tag Search
# Search with only tags, no regex
bm s -t Search
On macOS, hold down the command key and double-click on the URL to open it in your default browser.
Tags are just a way to organize bookmarks. Like labels in Gmail.
bm help tags
# List all tags sorted one per line
# If there are multiple of the same tag with different casing, they will be comma separated on the same line
bm tags
bm t
# Look for a specific tag
bm t |grep "query"
In your bashrc file, source
tool/bm_completions.bash
to get tab completions for tabs.
If fzf is installed, tags can also be completed using standard fzf
trigger tab completion.
# Example of normal tab completion
bm s -t <tab>
# Example searching for a tag using fzf (Assuming $FZF_COMPLETION_TRIGGER is **)
bm s -t **<tab>
Instructions on how to convert your existing bookmarks.
From a Chrome HTML export file:
# Folders will be turned into tags
perl -lne 'BEGIN{my @tags=(); print "URL|DESCRIPTION|TAGS"} if (/HREF="([^"]*)"[^>]*>([^<]*)</) {my $url=$1; $url =~ s/\|/%7C/g; my $d=$2; $d =~ s/\|/-/g; print "$url|$d|".join(",", @tags) }; push(@tags, $1) if />([^<]*)<\/H3/; pop(@tags) if /<\/DL>/' 2021_07_22_Chrome.html > bookmarks.csv
Requires installing Rust.
# Lint
cargo clippy --all-targets --all-features -- -D warnings
# Runs unit and integration tests
cargo test
cargo build
All these steps need to pass otherwise the CI build will fail.
# To keep a clean build, fail on any compiler warnings, not just errors
cargo clippy --workspace --all-targets --all-features -- --deny warnings
cargo test
cargo fmt
cargo build --release
cargo run -- add https://www.google.com "Google search engine" -t Search