Add input and output files. Remove old help.

This commit is contained in:
Arun Prakash Jana 2016-04-26 20:33:23 +05:30
parent 185ca828d1
commit e6b36ba892
No known key found for this signature in database
GPG Key ID: C0A712ED95043DCB

46
buku
View File

@ -955,50 +955,6 @@ def printmsg(msg, level=None):
def usage():
"""Show buku usage, options, general information and exit"""
print("Usage: OPTIONS [URL] [TAGS] [KEYWORDS ...]\n\n"
"A private cmdline bookmark manager. Your mini web!\n\n"
"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 0), N=0 deletes all\n"
" -g list all tags alphabetically\n"
" -m title manually set title, for -a, -i, -u; '-m none' clears title\n"
" -s keyword(s) search bookmarks for any keyword\n"
" -S keyword(s) search bookmarks with all keywords\n"
" -u N [URL] [tags] update fields of the entry at DB index N\n"
" The first keyword, if available, is treated as the URL.\n"
" If URL is omitted (and -m is not used) the title of entry at\n"
" index N is refreshed from the web, N=0 refreshes all titles.\n\n"
"Power toys\n"
" -e show bookmarks with empty titles or no tags\n"
" -i N insert new bookmark at free DB index N\n"
" -j show results in Json format\n"
" -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=0 shows all\n"
" -r oldtag [newtag] replace oldtag with newtag, delete oldtag if newtag 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 & tag\n"
" -z show debug information\n\n"
"Prompt keys\n"
" 1-N open Nth search result in browser\n"
" Enter exit buku\n\n"
"Version %.1f\n"
"Copyright (C) 2015 Arun Prakash Jana <engineerarun@gmail.com>\n"
"License: GPLv3\n"
"Webpage: https://github.com/jarun/buku\n" % _VERSION_)
sys.exit(1)
"""main starts here""" """main starts here"""
def main(argv = sys.argv): def main(argv = sys.argv):
# detects whether have pipe line parsing in # detects whether have pipe line parsing in
@ -1054,6 +1010,8 @@ argparser = ExtendedArgumentParser(
) )
addarg = argparser.add_argument addarg = argparser.add_argument
#addarg('infile', nargs='?', type=argparse.FileType('r'), default=sys.stdin, help=argparse.SUPPRESS)
addarg('outfile', nargs='?', type=argparse.FileType('w'), default=sys.stdout, help=argparse.SUPPRESS)
addarg('-a', '--add', nargs='+', dest='addurl', metavar=('URL', 'tags'), addarg('-a', '--add', nargs='+', dest='addurl', metavar=('URL', 'tags'),
help="bookmark URL with comma separated tags") help="bookmark URL with comma separated tags")
addarg('-d', '--delete', nargs='?', dest='delete', type=int, const=0, metavar='N', addarg('-d', '--delete', nargs='?', dest='delete', type=int, const=0, metavar='N',