From 536dc759eefdf9e885a9256cfc14bf36b0a4b036 Mon Sep 17 00:00:00 2001 From: christian Sillaber Date: Thu, 18 Aug 2016 17:19:53 +0200 Subject: [PATCH] added preliminary functionality to open a range of search results --- buku | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/buku b/buku index 71024dd..c109e9e 100755 --- a/buku +++ b/buku @@ -1237,9 +1237,9 @@ def prompt(results, noninteractive=False, delete=False): while True: try: - nav = input('Result number to open: ') + nav = input('Result number or range (x-y) to open: ') if not nav: - nav = input('Result number to open: ') + nav = input('Result number or range (x-y) to open: ') if not nav: # Quit on double enter break @@ -1257,6 +1257,15 @@ def prompt(results, noninteractive=False, delete=False): except Exception as e: _, _, linenumber, func, _, _ = inspect.stack()[0] logger.error('%s(), ln %d: %s', func, linenumber, e) + elif "-" in nav and is_int(nav.split("-")[0]) and is_int(nav.split("-")[1]): + lower = int(nav.split("-")[0]) + upper = int(nav.split("-")[1]) + for index in range(lower-1,upper-1): + try: + browser_open(unquote(results[index][1])) + except Exception as e: + _, _, linenumber, func, _, _ = inspect.stack()[0] + logger.error('%s(), ln %d: %s', func, linenumber, e) else: break