Removed -R. -R is now -u 0.

This commit is contained in:
Arun Prakash Jana 2016-04-21 23:18:42 +05:30
parent e4f0868657
commit 247052390d
No known key found for this signature in database
GPG Key ID: C0A712ED95043DCB
3 changed files with 27 additions and 17 deletions

View File

@ -125,7 +125,8 @@ You may need to use `sudo` with `PREFIX` depending on your permissions on destin
-m title manually specify the title, for -a, -i, -u
-s keyword(s) search bookmarks for any keyword
-S keyword(s) search bookmarks with all keywords
-u N URL [tags] update all fields of entry at DB index N
-u N [URL] [tags] update all fields of entry at DB index N, N=0 refreshes
all titles from the web. If N!=0, URL must be provided.
Power toys
-e show bookmarks with empty titles or no tags
@ -136,7 +137,6 @@ You may need to use `sudo` with `PREFIX` depending on your permissions on destin
-o N open URL at DB index N in browser
-p N show details of bookmark record at DB index N, N=0 shows 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
-z show debug information
@ -148,6 +148,7 @@ You may need to use `sudo` with `PREFIX` depending on your permissions on destin
## Operational notes
- The SQLite3 database file is stored in `$HOME/.local/share/buku/bookmarks.db` (or `$XDG_DATA_HOME/buku/bookmarks.db`, if XDG_DATA_HOME is defined) for each user. Before version 1.9, buku stored database in `$HOME/.cache/buku/bookmarks.db`. If the file exists, buku automatically moves it to new location.
- The database index for entries starts from 1. Index 0 is used for special operations like show or refresh or delete all bookmarks.
- It's advisable to copy URLs directly from the browser address bar, i.e., along with the leading `http://` or `https://` token. `buku` looks up title data (found within <title></title> tags of HTML) from the web ONLY for fully-formed HTTP(S) URLs.
- If the URL contains characters like `;`, `&` or brackets they may be interpreted specially by the shell. To avoid it, add the URL within single `'` or double `"` quotes.
- The same URL cannot be added twice. You can update tags and re-fetch title data. You can also insert a new bookmark at a free index.
@ -186,7 +187,7 @@ The assigned automatic index 15012014 is unique, one greater than highest index
Tags are updated too. Original tags are removed.
5. **Update** or refresh **full DB** with page titles from the web:
$ buku -R
$ buku -u 0
This operation does not modify the indexes, URLs or tags. Only titles, if non-empty, are refreshed.
6. **Delete** bookmark at index 15012014:

22
buku
View File

@ -68,7 +68,6 @@ update = False # Update a bookmark in DB
debug = False # Enable debug logs
titleData = None # Title fetched from a page
titleManual = None # Manually add a title offline
refresh = False # Refresh the full DB
replace = False # Replace a tag
jsonOutput = False # Output json formatted result
pipeargs = [] # Holds arguments piped to the program
@ -967,7 +966,8 @@ def usage():
" -m title manually specify the title, for -a, -i, -u\n"
" -s keyword(s) search bookmarks for any keyword\n"
" -S keyword(s) search bookmarks with all keywords\n"
" -u N URL [tags] update all fields of entry at DB index N\n\n"
" -u N [URL] [tags] update all fields of entry at DB index N, N=0 refreshes\n"
" all titles from the web. If N!=0, URL must be provided.\n\n"
"Power toys\n"
" -e show bookmarks with empty titles or no tags\n"
@ -978,7 +978,6 @@ def usage():
" -o N open URL at DB index N in browser\n"
" -p N show details of bookmark record at DB index N, N=0 shows 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"
" -z show debug information\n\n"
@ -1121,7 +1120,7 @@ try:
usage()
entry = opt[1]
if int(entry) <= 0:
if int(entry) < 0:
usage()
update = True
@ -1176,16 +1175,23 @@ if replace == True:
else:
replaceTags(conn, cur, keywords[0], keywords[1])
# Call add or update record
if addurl == True or update == True:
# Add record
if addurl == True:
if len(keywords) < 1:
conn.close()
usage()
AddUpdateEntry(conn, cur, keywords, entry)
# Refresh full DB
if refresh == True:
# Update record
if update == True:
if int(entry) > 0:
if len(keywords) < 1:
conn.close()
usage()
AddUpdateEntry(conn, cur, keywords, entry)
else:
dbRefresh(conn, cur)
# Search tags, URLs, Title info

13
buku.1
View File

@ -16,6 +16,8 @@ The SQLite3 database file is stored in \fB$HOME/.local/share/buku/bookmarks.db\f
.B buku
stored database in \fB$HOME/.cache/buku/bookmarks.db\fR. If the file exists, buku automatically moves it to new location.
.PP
The database index for entries starts from 1. Index 0 is used for special operations like show or refresh or delete all bookmarks.
.PP
It's advisable to copy URLs directly from the browser address bar, i.e., along with the leading 'http://' or 'https://' token. buku looks up title data (found within <title></title> tags of HTML) from the web ONLY for fully-formed HTTP(S) URLs.
.PP
If the URL contains characters like ';', '&' or brackets they may be interpreted specially by the shell. To avoid it, add the URL within single ''' or double '"' qoutes.
@ -86,9 +88,6 @@ in DB.
.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.
.TP
.BI \-s " keywords"
Search bookmarks for any of the keywords in URL, title or tags and show the results. Prompts to enter result number to open in browser. Note that the sequential index number may not match the real index in database. DB index is shown in the end within '()'.
.TP
@ -100,10 +99,14 @@ Use
.I N
(> 0) hash iterations to generate key, works with -k, -l.
.TP
.BI \-u " N" " " "URL" " " "[tags]"
.BI \-u " N" " " "[URL]" " " "[tags]"
Update all fields of bookmark at index
.I N
in DB.
.I N
= 0 refreshes all titles from the web. If
.I N
!= 0, URL must be provided.
.TP
.BI \-x " N"
Show selective monochrome output. Works with -p. If
@ -174,7 +177,7 @@ Tags are updated too. Original tags are removed.
.PP
.EX
.IP
.B buku -R
.B buku -u 0
.EE
.PP
.IP "" 4