# MarkIt ![Screenshot](markit.png) `markit` is a cmdline bookmark management utility written in Python3 and SQLite3. `markit` exists because of my monumental dependency on historious. I wanted the same database on my local system. However, I couldn't find an equally flexible cmdline solution. Hence, `MarkIt`! The SQLite3 database file is stored in `$HOME/.cache/markit/bookmarks.db` for each user. `markit` is GPLv3 licensed. If you find `markit` useful, please consider donating via PayPal. # Features - Add, update or remove a bookmark - Add tags to bookmarks - Optionally fetch page title data from the web (default: disabled) - Use (partial) tags or keywords to search bookmarks - Any or all search keyword match options - Unique URLs to avoid duplicates, show index if URL already exists - Open bookmark in browser using index - Open search results in browser - Browser (Chromium and Firefox based) errors and warnings suppression - Show single bookmark by ID or all bookmarks in a go - Refresh all bookmarks online - Delete all bookmarks - Add a bookmark at Nth index, to fill deleted bookmark indices - Secure parameterized SQLite3 queries to access database - Handle first level of redirections (reports IP blocking) - Unicode in URL works - UTF-8 request and response, page character set detection - Works with Python 3.x - Coloured output for clarity - Easily create compatible batch add or update scripts - Unformatted selective output (for creating batch update scripts) - Manpage for quick reference - Optional debug information - Fast and clean (no ads or clutter) - Minimal dependencies - Open source and free # Installation `markit` requires Python 3.x to work. 1. If you have git installed (the steps are tested on Ubuntu 14.04.3 x64_64):
$ git clone https://github.com/jarun/markit/ $ cd markit $ sudo make installTo remove, run:
$ sudo make uninstall2. If you do not have git installed: Download the latest stable release or development version source code. Extract, cd into the directory and run:
$ sudo make installIf you do not want to install, `markit` is standalone:
$ chmod +x markit $ ./markit ...# Usage Operational notes: - It's advisable to copy URLs directly from the browser address bar, i.e., along with the leading `http://` or `https://` token. `markit` looks up title data (found within
Usage: markit [OPTIONS] KEYWORDS... Bookmark manager. Your private Google. Options -a URL tag 1, tag 2, ... add URL as bookmark with comma separated tags -d N delete entry at DB index N (from -P output) -D delete ALL bookmarks -i N insert entry at DB index N, useful to fill deleted index -o N open URL at DB index N in browser -p N show details of bookmark record at DB index N -P show all bookmarks along with index from DB -R refresh all bookmarks, tags retained -s keyword(s) search all bookmarks for a (partial) tag or any keyword -S keyword(s) search all bookmarks for a (partial) tag or all keywords -u N update entry at DB index N -w fetch title info from web, works with -a, -i, -u -x N works with -P, N=1: show only URL, N=2: show URL and tag -z show debug information you can either add or update or delete in one instance any other option shows help and exits markit Keys 1-N open Nth search result in browser. Enter exits markit.# Examples 1. Add a new bookmark with tags `linux news` and `open source`:
$ markit -a http://tuxdiary.com linux news, open source Added at index 15012014The assigned automatic index 15012014 is unique, one greater than highest index already in use in database. 2. Add a bookmark, fetch page title information from web:
$ markit -a -w http://tuxdiary.com linux news, open source Title: [TuxDiary | Linux, open source and a pinch of leisure.] Added at index 150120143. Update existing bookmark at index 15012014 with a new tag:
$ markit -u 15012014 -w http://tuxdiary.com linux news, open source, magazine Title: [TuxDiary | Linux, open source and a pinch of leisure.] Updated4. Update or refresh full DB:
$ markit -R5. Delete bookmark at index 15012014:
$ markit -d 150120146. Delete all bookmarks:
$ markit -D7. Insert a bookmark at index 15012014 (fails if index or URL exists in database):
$ markit -i 15012014 -w http://tuxdiary.com/about linux news, open source Title: [A journey with WordPress | TuxDiary] Added at index 15012014This option is useful in filling deleted indices from database manually. 8. Show info on bookmark at index 15012014:
$ markit -p 150120149. Show all bookmarks with real index from database:
$ markit -P10. Open URL at index 15012014 in browser:
$ markit -o 1501201411. Search bookmarks for a tag matching `*kernel debugging*` or any of the keywords `*kernel*` and `*debugging*` in URL or title (separately):
$ markit -s kernel debugging12. Search bookmarks for a tag matching `*kernel debugging*` or all the keywords `*kernel*` and `*debugging*` in URL or title (separately):
$ markit -S kernel debugging13. Show debug info:
$ markit -z14. Show help:
$ markit15. Check manpage:
$ man markit16. `markit` doesn't have any import feature of its own. To import URLs in bulk, create a script with URLs and tags like the following (check TIP below):
#!/bin/bash markit -aw https://wireless.wiki.kernel.org/ networking, device drivers markit -aw https://courses.engr.illinois.edu/ece390/books/artofasm/ArtofAsm.html assembly markit -aw http://www.tittbit.in/ markit -aw http://www.mikroe.com/chapters/view/65/ electronics markit -aw "http://msdn.microsoft.com/en-us/library/bb470206(v=vs.85).aspx" file systems markit -aw http://www.ibm.com/developerworks/linux/library/l-linuxboot/index.html boot processMake the script executbale and run to batch add bookmarks. 17. To update selected URLs (refresh) along with your tags, first get the unformatted selective output with URL and tags:
$ markit -P -x 2 | tee myurlsRemove the lines you don't need. Add `markit -wu ` in front of all the other lines (check TIP below). Should look like:
#!/bin/bash markit -wu 50 https://wireless.wiki.kernel.org/ networking, device drivers markit -wu 51 https://courses.engr.illinois.edu/ece390/books/artofasm/ArtofAsm.html assembly markit -wu 52 http://www.tittbit.in/ markit -wu 53 http://www.mikroe.com/chapters/view/65/ electronics markit -wu 54 "http://msdn.microsoft.com/en-us/library/bb470206(v=vs.85).aspx" file systems markit -wu 55 http://www.ibm.com/developerworks/linux/library/l-linuxboot/index.html boot processRun the script:
$ chmod +x myurls $ ./myurlsTIP: To add the same text at the beginning of multiple lines using vim editor: - Press `Ctrl-v` to select the first column of text in the lines you want to change (visual mode). - Press `Shift-i` and type the text you want to insert. - Hit `Esc`, wait 1 second and the inserted text will appear on every line. Using sed:
$ sed -i 's/^/markit -wu /' filename#License GPL v3 Copyright (C) 2015 by Arun Prakash Jana <engineerarun@gmail.com> # Contributions I would love to see pull requests with the following features: - Exact word match (against substring in a word as it works currently. Hint: REGEXP) - Parse full page data??? Might end up writing a search engine like Google. ;) - Optional password protection # Developer(s) Arun Prakash Jana <engineerarun@gmail.com>