Merge -P with -p. Now -P is -p 0.
This commit is contained in:
parent
198ff40d50
commit
08fb03eec1
11
README.md
11
README.md
@ -121,7 +121,7 @@ You may need to use `sudo` with `PREFIX` depending on your permissions on destin
|
||||
|
||||
General options
|
||||
-a URL [tags] add URL as bookmark with comma separated tags
|
||||
-d N delete entry at DB index N (from -P), move last entry to N
|
||||
-d N delete entry at DB index N (from -p 0), move last entry to N
|
||||
-g list all tags alphabetically
|
||||
-m title manually specify the title, for -a, -i, -u
|
||||
-s keyword(s) search bookmarks for any keyword
|
||||
@ -137,12 +137,11 @@ You may need to use `sudo` with `PREFIX` depending on your permissions on destin
|
||||
-k decrypt (unlock) database file
|
||||
-l encrypt (lock) database file
|
||||
-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
|
||||
-p N show details of bookmark record at DB index N (0 for all)
|
||||
-r oldtag [newtag] replace oldtag with newtag, delete oldtag if newtag empty
|
||||
-R refresh title from web for all bookmarks, update if non-empty
|
||||
-t N use N (> 0) hash iterations to generate key, for -k, -l
|
||||
-x N modify -P behaviour, N=1: show only URL, N=2: show URL and tag
|
||||
-x N modify -p behaviour, N=1: show only URL, N=2: show URL and tag
|
||||
-z show debug information
|
||||
|
||||
Keys
|
||||
@ -215,7 +214,7 @@ The last index is moved to the deleted index to keep the DB compact.
|
||||
$ buku -p 15012014
|
||||
12. **Show all** bookmarks with real index from database:
|
||||
|
||||
$ buku -P
|
||||
$ buku -p 0
|
||||
13. **Open URL** at index 15012014 in browser:
|
||||
|
||||
$ buku -o 15012014
|
||||
@ -261,7 +260,7 @@ Use the `-u` option to add title or tags to those entries, if you want to.
|
||||
Make the script executable and run to batch add bookmarks.
|
||||
3. To **update selected URLs** (refresh) along with your tags, first get the unformatted selective output with URL and tags:
|
||||
|
||||
$ buku -P -x 2 | tee myurls
|
||||
$ buku -p 0 -x 2 | tee myurls
|
||||
Remove the lines you don't need. Add `buku -wu ` in front of all the other lines (check TIP below). Should look like:
|
||||
|
||||
#!/bin/bash
|
||||
|
24
buku
24
buku
@ -59,7 +59,6 @@ online = False # Fetch title from web
|
||||
delete = False # Delete bookmark(s)
|
||||
empty = False # List all bookmarks with no title or tag
|
||||
openurl = None # Open URL in browser
|
||||
show = False # Show all details of a bookmark
|
||||
showindex = None # Index of bookmark to show
|
||||
showOpt = 0 # Modify show. 1: show only URL, 2: show URL and tag
|
||||
showTags = False # List all unique tags
|
||||
@ -601,7 +600,7 @@ def printdb(cur, index, empty=False):
|
||||
global jsonOutput
|
||||
|
||||
resultset = None
|
||||
if index == None: # Show all entries
|
||||
if int(index) == 0: # Show all entries
|
||||
if empty == False:
|
||||
cur.execute('SELECT * FROM bookmarks')
|
||||
resultset = cur.fetchall()
|
||||
@ -962,7 +961,7 @@ def usage():
|
||||
|
||||
"General options\n"
|
||||
" -a URL [tags] add URL as bookmark with comma separated tags\n"
|
||||
" -d N delete entry at DB index N (from -P), move last entry to N\n"
|
||||
" -d N delete entry at DB index N (from -p 0), move last entry to N\n"
|
||||
" -g list all tags alphabetically\n"
|
||||
" -m title manually specify the title, for -a, -i, -u\n"
|
||||
" -s keyword(s) search bookmarks for any keyword\n"
|
||||
@ -978,12 +977,11 @@ def usage():
|
||||
" -k decrypt (unlock) database file\n"
|
||||
" -l encrypt (lock) database file\n"
|
||||
" -o N open URL at DB index N in browser\n"
|
||||
" -p N show details of bookmark record at DB index N\n"
|
||||
" -P show all bookmarks along with index from DB\n"
|
||||
" -p N show details of bookmark record at DB index N (0 for all)\n"
|
||||
" -r oldtag [newtag] replace oldtag with newtag, delete oldtag if newtag empty\n"
|
||||
" -R refresh title from web for all bookmarks, update if non-empty\n"
|
||||
" -t N use N (> 0) hash iterations to generate key, for -k, -l\n"
|
||||
" -x N modify -P behaviour, N=1: show only URL, N=2: show URL and tag\n"
|
||||
" -x N modify -p behaviour, N=1: show only URL, N=2: show URL and tag\n"
|
||||
" -z show debug information\n\n"
|
||||
|
||||
"Keys\n"
|
||||
@ -1022,9 +1020,9 @@ if len(sys.argv) < 2:
|
||||
try:
|
||||
|
||||
if len(pipeargs) > 0:
|
||||
optlist, keywords = getopt(pipeargs[1:], "d:i:m:o:p:t:u:x:aDegjklPRrsSwz")
|
||||
optlist, keywords = getopt(pipeargs[1:], "d:i:m:o:p:t:u:x:aDegjklRrsSwz")
|
||||
else:
|
||||
optlist, keywords = getopt(sys.argv[1:], "d:i:m:o:p:t:u:x:aDegjklPRrsSwz")
|
||||
optlist, keywords = getopt(sys.argv[1:], "d:i:m:o:p:t:u:x:aDegjklRrsSwz")
|
||||
if len(optlist) < 1:
|
||||
usage()
|
||||
|
||||
@ -1099,12 +1097,8 @@ try:
|
||||
usage()
|
||||
|
||||
showindex = opt[1]
|
||||
if int(showindex) <= 0:
|
||||
if int(showindex) < 0:
|
||||
usage()
|
||||
|
||||
show = True
|
||||
elif opt[0] == "-P":
|
||||
show = True
|
||||
elif opt[0] == "-R":
|
||||
if addurl == True or delete == True:
|
||||
print("You can either add or update or delete in one instance\n")
|
||||
@ -1217,7 +1211,7 @@ if search == True:
|
||||
searchdb(cur, keywords)
|
||||
|
||||
# Print all records
|
||||
if show == True:
|
||||
if showindex is not None:
|
||||
printdb(cur, showindex)
|
||||
|
||||
# Show all unique tags
|
||||
@ -1225,7 +1219,7 @@ if showTags == True:
|
||||
showUniqueTags(cur)
|
||||
|
||||
if empty == True:
|
||||
printdb(cur, None, empty)
|
||||
printdb(cur, 0, empty)
|
||||
|
||||
# Open URL in browser
|
||||
if openurl != None:
|
||||
|
13
buku.1
13
buku.1
@ -45,7 +45,7 @@ along with comma separated tags. A tag can have multiple words. The same URL can
|
||||
.BI \-d " N"
|
||||
Delete bookmark at index
|
||||
.I N
|
||||
in DB (from -P output).
|
||||
in DB (from -p 0 output).
|
||||
.TP
|
||||
.B \-D
|
||||
Delete ALL bookmarks.
|
||||
@ -62,7 +62,7 @@ Add a new record at free index
|
||||
in DB.
|
||||
.TP
|
||||
.B \-j
|
||||
Output data formatted as json (works with -P, -p and -s)
|
||||
Output data formatted as json (works with -p and -s)
|
||||
.TP
|
||||
.B \-k
|
||||
Decrypt (unlock) the DB file.
|
||||
@ -82,9 +82,8 @@ in browser.
|
||||
Show details of bookmark record stored at index
|
||||
.I N
|
||||
in DB.
|
||||
.TP
|
||||
.B \-P
|
||||
Show all bookmark records from the DB along with actual index. Shows URL, title and tags.
|
||||
.I N
|
||||
= 0 shows all records with actual index from DB. Shows URL, title and tags.
|
||||
.TP
|
||||
.B \-R
|
||||
Refresh titles for all bookmarks from the web. Titles are updated only if non-empty. Indexes, URLs and tags are retained.
|
||||
@ -109,7 +108,7 @@ in DB.
|
||||
Fetch title data from the web. Works with -a, -i or -u options.
|
||||
.TP
|
||||
.BI \-x " N"
|
||||
Show selective monochrome output. Works with -P. If
|
||||
Show selective monochrome output. Works with -p. If
|
||||
.I N
|
||||
= 1, only URL is shown. If
|
||||
.I N
|
||||
@ -234,7 +233,7 @@ List \fBall unique tags\fR alphabetically:
|
||||
.PP
|
||||
.EX
|
||||
.IP
|
||||
.B buku -P
|
||||
.B buku -p 0
|
||||
.PP
|
||||
.IP 13. 4
|
||||
\fBOpen URL\fR at index 15012014 in browser:
|
||||
|
Loading…
Reference in New Issue
Block a user