diff --git a/README.md b/README.md index b63a9a8..57e1772 100644 --- a/README.md +++ b/README.md @@ -162,14 +162,14 @@ Shell completion scripts for Bash, Fish and Zsh can be found in respective subdi search options: -s, --sany keyword [...] - search records for ANY matching keyword + search records with ANY keyword -S, --sall keyword [...] search records with ALL keywords special keywords - "blank": entries with empty title/tag "immutable": entries with locked title --deep match substrings ('pen' matches 'opened') - --sreg expr run a regex search + --sreg expression run a regex search --stag [...] search bookmarks by a tag list tags alphabetically, if no arguments @@ -205,10 +205,6 @@ Shell completion scripts for Bash, Fish and Zsh can be found in respective subdi --upstream check latest upstream version available -z, --debug show debug information and additional logs - prompt keys: - 1-N browse search result indices and/or ranges - q, double Enter exit buku - symbols: > title + comment @@ -440,4 +436,4 @@ Pull requests are welcome. Please visit [#78](https://github.com/jarun/Buku/issu ## Copyright -Copyright (C) 2015-2016 [Arun Prakash Jana](mailto:engineerarun@gmail.com) +Copyright © 2015-2016 [Arun Prakash Jana](mailto:engineerarun@gmail.com) diff --git a/buku.1 b/buku.1 index 61bd03e..bfdad34 100644 --- a/buku.1 +++ b/buku.1 @@ -91,7 +91,7 @@ Set the title of a bookmark immutable during updates. Works with --add, --update .SH SEARCH OPTIONS .TP .BI \-s " " \--sany " keyword [...]" -Search bookmarks for ANY of the keyword(s) in URL, title or tags and show the results. Prompts to enter result number to open in browser. Note that the sequential result index is not the DB index. The DB index is shown in bold within '[]' after the URL. +Search bookmarks with ANY of the keyword(s) in URL, title or tags and show the results. Prompts to enter result number to open in browser. Note that the sequential result index is not the DB index. The DB index is shown in bold within '[]' after the URL. .TP .BI \-S " " \--sall " keyword [...]" Search bookmarks with ALL keywords in URL, title or tags and show the results. Behaviour same as --sany. @@ -104,7 +104,7 @@ Special keywords: .br NOTE: To search the keywords, use --sany .TP -.BI \--sreg " expr" +.BI \--sreg " expression" Scan for a regular expression match. .TP .BI \--deep @@ -192,11 +192,30 @@ Show debug information and additional logs. .SH PROMPT KEYS .TP .BI "1-N" -Open the -.I Nth -search result in browser. Multiple bookmarks are opened if ranges or space-separated result indices are specified. +Browse search results by indices and ranges. .TP -.BI "q, double Enter" +.BI "a" +Open all search results in browser. +.TP +.BI "s" " keyword [...]" +Search for records with ANY keyword. +.TP +.BI "S" " keyword [...]" +Search for records with ALL keywords. +.TP +.BI "d" +Toggle deep search to match substrings ('pen' matches 'opened'). +.TP +.BI "r" " expression" +Run a regular expression search. +.TP +.BI "t" " [...]" +Search bookmarks by a tag. List all tags alphabetically, if no arguments. +.TP +.BI "?" +Show help on prompt keys. +.TP +.BI "q, ^D, double Enter" Exit buku. .SH ENVIRONMENT .TP diff --git a/buku.py b/buku.py index 52e516f..33bb515 100755 --- a/buku.py +++ b/buku.py @@ -1641,6 +1641,7 @@ def prompt(obj, results, noninteractive=False): if not nav: # Quit on double enter break + nav = nav.strip() except EOFError: return @@ -1690,6 +1691,12 @@ def prompt(obj, results, noninteractive=False): new_results = False continue + # Show help with '?' + if nav == '?': + ExtendedArgumentParser.print_prompt_help(sys.stdout) + new_results = False + continue + new_results = False # Nothing to browse if there are no results @@ -1952,29 +1959,43 @@ class CustomTagSearchAction(argparse.Action): class ExtendedArgumentParser(argparse.ArgumentParser): '''Extend classic argument parser''' - # Print additional help and info + # Print program info @staticmethod - def print_extended_help(file=None): + def print_program_info(file=None): file.write(''' -prompt keys: - 1-N browse search result indices and/or ranges - q, double Enter exit buku - symbols: > title + comment # tags + Version %s -Copyright (C) 2015-2016 Arun Prakash Jana +© 2015-2016 Arun Prakash Jana License: GPLv3 Webpage: https://github.com/jarun/Buku ''' % __version__) + # Print prompt help + @staticmethod + def print_prompt_help(file=None): + file.write(''' +keys: + 1-N browse search result indices and/or ranges + a open all results in browser + s keyword [...] search for records with ANY keyword + S keyword [...] search for records with ALL keywords + d match substrings ('pen' matches 'opened') + r expression run a regex search + t [...] search bookmarks by a tag or list all tags + ? show this help + q, ^D, double Enter exit buku + +''') + # Help def print_help(self, file=None): super(ExtendedArgumentParser, self).print_help(file) - self.print_extended_help(file) + self.print_program_info(file) # Handle piped input @@ -2071,14 +2092,14 @@ def main(): search_grp = argparser.add_argument_group( title='search options', description='''-s, --sany keyword [...] - search records for ANY matching keyword + search records with ANY keyword -S, --sall keyword [...] search records with ALL keywords special keywords - "blank": entries with empty title/tag "immutable": entries with locked title --deep match substrings ('pen' matches 'opened') ---sreg expr run a regex search +--sreg expression run a regex search --stag [...] search bookmarks by a tag list tags alphabetically, if no arguments''') addarg = search_grp.add_argument