Update, reorder, align help and examples.

This commit is contained in:
Arun Prakash Jana 2017-03-17 08:35:27 +05:30
parent 7fae7b47b7
commit fc5ee94b86
3 changed files with 51 additions and 57 deletions

View File

@ -21,10 +21,10 @@
- [Features](#features) - [Features](#features)
- [Installation](#installation) - [Installation](#installation)
- [Dependencies](#dependencies) - [Dependencies](#dependencies)
- [Installing with a package manager](#installing-with-a-package-manager)
- [Installing from this repository](#installing-from-this-repository) - [Installing from this repository](#installing-from-this-repository)
- [Running as a standalone utility](#running-as-a-standalone-utility) - [Running as a standalone utility](#running-as-a-standalone-utility)
- [Debian package](#debian-package) - [Debian package](#debian-package)
- [Installing with a package manager](#installing-with-a-package-manager)
- [Shell completion](#shell-completion) - [Shell completion](#shell-completion)
- [Usage](#usage) - [Usage](#usage)
- [Cmdline options](#cmdline-options) - [Cmdline options](#cmdline-options)
@ -83,19 +83,26 @@ There are several [projects](#related-projects) based on `buku`, including a bro
| Import browser exported html | beautifulsoup4 | | Import browser exported html | beautifulsoup4 |
| Shorten URL, check latest release | requests | | Shorten URL, check latest release | requests |
To install package dependencies, run: To install package dependencies using pip3, run:
$ sudo pip3 install urllib3 cryptography beautifulsoup4 requests $ sudo pip3 install urllib3 cryptography beautifulsoup4 requests
or on Ubuntu: or on Ubuntu:
$ sudo apt-get install python3-urllib3 python3-cryptography python3-bs4 python3-requests $ sudo apt-get install python3-urllib3 python3-cryptography python3-bs4 python3-requests
### Installing with a package manager
- [PyPi](https://pypi.python.org/pypi/buku/) (`$ pip3 install buku`)
- [AUR](https://aur.archlinux.org/packages/buku/)
- [Homebrew](http://braumeister.org/formula/buku)
- [Debian](https://packages.debian.org/search?keywords=buku&searchon=names&exact=1)
- [Ubuntu](http://packages.ubuntu.com/search?keywords=buku&searchon=names&exact=1)
- [Ubuntu PPA](https://launchpad.net/~twodopeshaggy/+archive/ubuntu/jarun/)
- [Void Linux](https://github.com/voidlinux/void-packages/tree/master/srcpkgs/buku) (`$ sudo xbps-install -S buku`)
### Installing from this repository ### Installing from this repository
If you have git installed, run: If you have git installed, clone this repository. Otherwise download the latest [stable release](https://github.com/jarun/Buku/releases/latest) or [development version](https://github.com/jarun/Buku/archive/master.zip) (*risky*).
$ git clone https://github.com/jarun/Buku/
or download the latest [stable release](https://github.com/jarun/Buku/releases/latest) or [development version](https://github.com/jarun/Buku/archive/master.zip) (*risky*).
Install to default location (`/usr/local`): Install to default location (`/usr/local`):
@ -121,16 +128,6 @@ If you are on a Debian (including Ubuntu) based system visit [the latest stable
Please substitute `$version` with the appropriate package version. Please substitute `$version` with the appropriate package version.
### Installing with a package manager
- [PyPi](https://pypi.python.org/pypi/buku/) (`$ pip install buku`)
- [AUR](https://aur.archlinux.org/packages/buku/)
- [Homebrew](http://braumeister.org/formula/buku)
- [Debian](https://packages.debian.org/search?keywords=buku&searchon=names&exact=1)
- [Ubuntu](http://packages.ubuntu.com/search?keywords=buku&searchon=names&exact=1)
- [Ubuntu PPA](https://launchpad.net/~twodopeshaggy/+archive/ubuntu/jarun/)
- [Void Linux](https://github.com/voidlinux/void-packages/tree/master/srcpkgs/buku) (`$ sudo xbps-install -S buku`)
## Shell completion ## Shell completion
Shell completion scripts for Bash, Fish and Zsh can be found in respective subdirectories of [auto-completion/](https://github.com/jarun/Buku/blob/master/auto-completion). Please refer to your shell's manual for installation instructions. Shell completion scripts for Bash, Fish and Zsh can be found in respective subdirectories of [auto-completion/](https://github.com/jarun/Buku/blob/master/auto-completion). Please refer to your shell's manual for installation instructions.
@ -174,7 +171,7 @@ EDIT OPTIONS:
'+' appends to, '-' removes from tagset '+' appends to, '-' removes from tagset
--title [...] bookmark title; if no arguments: --title [...] bookmark title; if no arguments:
-a: do not set title, -u: clear title -a: do not set title, -u: clear title
-c, --comment [...] description of the bookmark -c, --comment [...] notes or description of the bookmark
clears description, if no arguments clears description, if no arguments
--immutable N disable title fetch from web on update --immutable N disable title fetch from web on update
N=0: mutable (default), N=1: immutable N=0: mutable (default), N=1: immutable
@ -210,15 +207,14 @@ POWER TOYS:
-1 shows the bookmark with highest index -1 shows the bookmark with highest index
-f, --format N limit fields in -p or Json search output -f, --format N limit fields in -p or Json search output
N=1: URL, N=2: URL and tag, N=3: title N=1: URL, N=2: URL and tag, N=3: title
--replace oldtag [newtag ...]
replace oldtag with newtag everywhere
delete oldtag, if newtag not specified
-j, --json Json formatted output for -p and search -j, --json Json formatted output for -p and search
--nc disable color output --nc disable color output
--np do not show the prompt, run and exit --np do not show the prompt, run and exit
-o, --open [...] browse bookmarks by indices and ranges -o, --open [...] browse bookmarks by indices and ranges
open a random bookmark, if no arguments open a random bookmark, if no arguments
--oa browse all search results immediately --oa browse all search results immediately
--replace old new replace old tag with new tag everywhere
delete old tag, if new tag not specified
--shorten index|URL fetch shortened url from tny.im service --shorten index|URL fetch shortened url from tny.im service
--expand index|URL expand a tny.im shortened url --expand index|URL expand a tny.im shortened url
--tacit reduce verbosity --tacit reduce verbosity
@ -361,7 +357,6 @@ NOTE: This flexibility is not exposed in the program.
## Examples ## Examples
1. **Edit and add** a bookmark from editor: 1. **Edit and add** a bookmark from editor:
$ buku -w $ buku -w
@ -444,7 +439,7 @@ The last index is moved to the deleted index to keep the DB compact.
$ buku --stag $ buku --stag
20. Run a **search and update** the results: 20. Run a **search and update** the results:
$ buku -s kernel debugging -u --tag + newtag $ buku -s kernel debugging -u --tag + linux kernel
21. Run a **search and delete** the results: 21. Run a **search and delete** the results:
$ buku -s kernel debugging -d $ buku -s kernel debugging -d
@ -462,7 +457,7 @@ The same number of iterations must be specified for one lock & unlock instance.
$ buku -p | more $ buku -p | more
25. **Replace tag** 'old tag' with 'new tag': 25. **Replace tag** 'old tag' with 'new tag':
$ buku --replace 'old tag' new tag $ buku --replace 'old tag' 'new tag'
26. **Delete tag** 'old tag' from DB: 26. **Delete tag** 'old tag' from DB:
$ buku --replace 'old tag' $ buku --replace 'old tag'

30
buku.1
View File

@ -115,7 +115,7 @@ Specify comma separated tags, works with --add, --update. Clears the tags, if no
Manually specify the title, works with --add, --update. Omits or clears the title, if no arguments passed. Manually specify the title, works with --add, --update. Omits or clears the title, if no arguments passed.
.TP .TP
.BI \-c " " \--comment " [...]" .BI \-c " " \--comment " [...]"
Add comment or description on the bookmark, works with --add, --update. Clears the comment, if no arguments passed. Add notes or description of the bookmark, works with --add, --update. Clears the comment, if no arguments passed.
.TP .TP
.BI \--immutable " N" .BI \--immutable " N"
Set the title of a bookmark immutable during updates. Works with --add, --update. N=1 sets the immutable flag, N=0 removes it. If omitted, bookmarks are added with N=0. Set the title of a bookmark immutable during updates. Works with --add, --update. N=1 sets the immutable flag, N=0 removes it. If omitted, bookmarks are added with N=0.
@ -188,17 +188,6 @@ Show selective monochrome output with specific fields. Works with --print. Searc
.I N .I N
= 3, show only title. = 3, show only title.
.TP .TP
.BI \--replace " oldtag [newtag ...]"
Replace
.I oldtag
with
.I newtag
if both are passed; delete
.I oldtag
if
.I newtag
is omitted.
.TP
.BI \-j " " \--json .BI \-j " " \--json
Output data formatted as json, works with --print output and search results. Output data formatted as json, works with --print output and search results.
.TP .TP
@ -214,6 +203,17 @@ Open bookmarks by DB indices or ranges in browser. Open a random index if argume
.BI \--oa .BI \--oa
Open all search results immediately in the browser. Works best with --np. When used along with --update or --delete, URLs are opened in the browser first and then modified or deleted. Open all search results immediately in the browser. Works best with --np. When used along with --update or --delete, URLs are opened in the browser first and then modified or deleted.
.TP .TP
.BI \--replace " old new"
Replace
.I old
tag with
.I new
tag if both are passed; delete
.I old
tag if
.I new
tag is not specified.
.TP
.BI \--shorten " index|URL" .BI \--shorten " index|URL"
Shorten the URL at DB Shorten the URL at DB
.I index .I index
@ -264,7 +264,7 @@ Run a regular expression search.
.BI "t" " [...]" .BI "t" " [...]"
Search bookmarks by a tag. List all tags alphabetically, if no arguments. The index of a tag from the tag list can be used to search all bookmarks having the tag. Note that multiple indices and/or ranges do not work in this case. Search bookmarks by a tag. List all tags alphabetically, if no arguments. The index of a tag from the tag list can be used to search all bookmarks having the tag. Note that multiple indices and/or ranges do not work in this case.
.TP .TP
.BI "w" " [index|editor]" .BI "w" " [editor|index]"
Edit and add or update a bookmark. Edit and add or update a bookmark.
.TP .TP
.BI "?" .BI "?"
@ -489,7 +489,7 @@ Run a \fBsearch and update\fR the results:
.PP .PP
.EX .EX
.IP .IP
.B buku -s kernel debugging -u --tag + newtag .B buku -s kernel debugging -u --tag + linux kernel
.EE .EE
.PP .PP
.IP 21. 4 .IP 21. 4
@ -535,7 +535,7 @@ The same number of iterations must be specified for one lock & unlock instance.
.PP .PP
.EX .EX
.IP .IP
.B buku --replace 'old tag' new tag .B buku --replace 'old tag' 'new tag'
.EE .EE
.PP .PP
.IP 26. 4 .IP 26. 4

11
buku.py
View File

@ -1636,7 +1636,7 @@ keys:
d match substrings ('pen' matches 'opened') d match substrings ('pen' matches 'opened')
r expression run a regex search r expression run a regex search
t [...] search bookmarks by a tag or show tag list t [...] search bookmarks by a tag or show tag list
w [index|editor] edit and add or update a bookmark w [editor|index] edit and add or update a bookmark
(tag list index fetches bookmarks by tag) (tag list index fetches bookmarks by tag)
? show this help ? show this help
q, ^D, double Enter exit buku q, ^D, double Enter exit buku
@ -2570,7 +2570,7 @@ POSITIONAL ARGUMENTS:
'+' appends to, '-' removes from tagset '+' appends to, '-' removes from tagset
--title [...] bookmark title; if no arguments: --title [...] bookmark title; if no arguments:
-a: do not set title, -u: clear title -a: do not set title, -u: clear title
-c, --comment [...] description of the bookmark -c, --comment [...] notes or description of the bookmark
clears description, if no arguments clears description, if no arguments
--immutable N disable title fetch from web on update --immutable N disable title fetch from web on update
N=0: mutable (default), N=1: immutable''') N=0: mutable (default), N=1: immutable''')
@ -2636,15 +2636,14 @@ POSITIONAL ARGUMENTS:
-1 shows the bookmark with highest index -1 shows the bookmark with highest index
-f, --format N limit fields in -p or Json search output -f, --format N limit fields in -p or Json search output
N=1: URL, N=2: URL and tag, N=3: title N=1: URL, N=2: URL and tag, N=3: title
--replace oldtag [newtag ...]
replace oldtag with newtag everywhere
delete oldtag, if newtag not specified
-j, --json Json formatted output for -p and search -j, --json Json formatted output for -p and search
--nc disable color output --nc disable color output
--np do not show the prompt, run and exit --np do not show the prompt, run and exit
-o, --open [...] browse bookmarks by indices and ranges -o, --open [...] browse bookmarks by indices and ranges
open a random bookmark, if no arguments open a random bookmark, if no arguments
--oa browse all search results immediately --oa browse all search results immediately
--replace old new replace old tag with new tag everywhere
delete old tag, if new tag not specified
--shorten index|URL fetch shortened url from tny.im service --shorten index|URL fetch shortened url from tny.im service
--expand index|URL expand a tny.im shortened url --expand index|URL expand a tny.im shortened url
--tacit reduce verbosity --tacit reduce verbosity
@ -2658,12 +2657,12 @@ POSITIONAL ARGUMENTS:
addarg('-m', '--merge', nargs=1, help=HIDE) addarg('-m', '--merge', nargs=1, help=HIDE)
addarg('-p', '--print', nargs='*', help=HIDE) addarg('-p', '--print', nargs='*', help=HIDE)
addarg('-f', '--format', type=int, default=0, choices={1, 2, 3}, help=HIDE) addarg('-f', '--format', type=int, default=0, choices={1, 2, 3}, help=HIDE)
addarg('--replace', nargs='+', help=HIDE)
addarg('-j', '--json', action='store_true', help=HIDE) addarg('-j', '--json', action='store_true', help=HIDE)
addarg('--nc', action='store_true', help=HIDE) addarg('--nc', action='store_true', help=HIDE)
addarg('--np', action='store_true', help=HIDE) addarg('--np', action='store_true', help=HIDE)
addarg('-o', '--open', nargs='*', help=HIDE) addarg('-o', '--open', nargs='*', help=HIDE)
addarg('--oa', action='store_true', help=HIDE) addarg('--oa', action='store_true', help=HIDE)
addarg('--replace', nargs='+', help=HIDE)
addarg('--shorten', nargs=1, help=HIDE) addarg('--shorten', nargs=1, help=HIDE)
addarg('--expand', nargs=1, help=HIDE) addarg('--expand', nargs=1, help=HIDE)
addarg('--tacit', action='store_true', help=HIDE) addarg('--tacit', action='store_true', help=HIDE)