Skip to main content

CLI bookmark manager based on buku

Project description

twbm: Bookmarks via Commandline (CLI)

Inspired by https://github.com/jarun/buku.

Why not just use it directly?

  • better full-text search.
  • check tags for consistency when adding new bookmark
  • alphabetical ordering of deep search results
  • no tools like bukuserver, only CLI

If you are happy using buku, by all means stick with it. It is battle tested.

twbm is 100% buku compatible.
Switch back and forth between twbm and buku is possible without data loss.

To harness twbm's power, use correct FTS search syntax (see: https://www.sqlite.org/fts5.html chapter 3).

Usage

Two complementary commands are provided:

  1. twbm: CLI tool with FTS for bookmark management
  2. twbuku: plain buku with small enhancements and usage of an enhanced database

This allows to use the battle-tested buku interface where applicable and benefit from additional features while using one enhanced bookmark database.

Getting help: twbm --help

Examples

# FTS examples (https://www.sqlite.org/fts5.htm)
twbm search 'security "single-page"'
twbm search '"https://securit" *'
twbm search '^security'
twbm search 'postgres OR sqlite'
twbm search 'security NOT keycloak'

# FTS combined with tag filtering
twbm search -t tag1,tag2 -n notag1 <searchquery>

# Match exact taglist
twbm search -e tag1,tag2

# Search -> select interactively -> pipe bookmark id downstream for processing
twbm search xxxxx | twbm update -t x

# Search by any tag and sort by bookmark age ascending
twbm search -T tag1,tag2 -O

Taglists must not have blanks and have comma separator.

Selection of multiple bookmarks for opening in browser is possible, of course: Multi selection

After selecting you are straight back at the bash prompt.

Installation

pipx twbm

Database schema upgrade:

  • To upgrade existing buku-db: twbm-upgrade-db.sh buku.db twbm.db.
  • To downgrade twbm-db: twbm-downgrade-db.sh twbm.db buku.db.

All transactions do not affect existing databases.

Tested configuration:

  • sqlite 3.28.0 (requires update on macOS)
  • macOS 10.15.7

Configuration

Location of sqlite database:

# aliases which I use
alias b="twbuku --db $HOME/bm.db -n 1000 --deep"  # using patched original buku

alias bb="TWBM_DB_URL=sqlite:////$HOME/bm.db twbm search"  # using extended CLI tool
alias bbb="TWBM_DB_URL=sqlite:////$HOME/bm.db twbm"

Architecture

twbm uses a few buku functions in the background, but is generally rebuilt on top of:

This should make it easy to extend and add functionality in an object-oriented manner.

Development

patch buku

  • download buku and compare with buku.py
  • update buku.py: # tw: add title tagging (customization: search for # tw)
  • GOTCHA: Exclude buku.py from black
rm buku
wget https://raw.githubusercontent.com/jarun/buku/master/buku .
diff buku.py buku

Local installation from sources

  • install twbm with pipx for local development: pipx install ~/dev/py/twbm, via make install
  • uninstall: pipx uninstall twbm # GOTCHA: NOT THE PATH !!!!

Testing

make test

Roadmap

  • tbd

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

twbm-0.8.0.tar.gz (69.1 kB view details)

Uploaded Source

File details

Details for the file twbm-0.8.0.tar.gz.

File metadata

  • Download URL: twbm-0.8.0.tar.gz
  • Upload date:
  • Size: 69.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for twbm-0.8.0.tar.gz
Algorithm Hash digest
SHA256 e5f4602f24c5fe4d9f68d51229738a4d96229a7bc45ac206dc12de6c05c37421
MD5 d05907154200ce0021bfcf9ef7f01ae5
BLAKE2b-256 4031908b32954a8da8ffc3e3632ee39c15664c117d14e7cc81db04626c70f1e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page