From 8c1ba91f22696451b12176f52bc0224a85757de6 Mon Sep 17 00:00:00 2001 From: Fbenas Date: Sun, 8 Nov 2020 16:40:42 +0000 Subject: Fix index searching --- wikiquery | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wikiquery b/wikiquery index 0851a4b..47233e3 100755 --- a/wikiquery +++ b/wikiquery @@ -86,10 +86,14 @@ def main(): if args: topic = args.pop(0) - while len(args) > 0 and not(isinstance(args[0], (int))): + while len(args) > 0 and not(args[0].isdigit()): topic += " " + args.pop(0) - index = int(args.pop(0)) if args else None + index = int(args.pop(0)) -1 if args else None + + if index < 1: + print ("Cannot search for index < 1") + sys.exit(0) if options.search: search(topic, index) -- cgit v1.2.3