From fea55856a9b2e24820ef73869bfb47079bf5fe1c Mon Sep 17 00:00:00 2001 From: FBeans Date: Thu, 12 Nov 2020 20:05:26 +0000 Subject: Remove check for negative index as it's already handled from the parser of args --- wikiquery | 4 ---- 1 file changed, 4 deletions(-) diff --git a/wikiquery b/wikiquery index 47233e3..948d850 100755 --- a/wikiquery +++ b/wikiquery @@ -91,10 +91,6 @@ def main(): 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) elif options.url: -- cgit v1.2.3 From 6aa1ba47a2f02d64d7b8b1d332a402956fc18cee Mon Sep 17 00:00:00 2001 From: FBeans Date: Thu, 12 Nov 2020 20:15:13 +0000 Subject: Just show the user the real indexes (starting from 0). This fixes the need to change anything --- wikiquery | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wikiquery b/wikiquery index 948d850..d133ac1 100755 --- a/wikiquery +++ b/wikiquery @@ -12,7 +12,7 @@ version = "0.1.7" def stringify(o): if isinstance(o, list): output = [] - for i, item in enumerate(o, 1): + for i, item in enumerate(o, 0): output.append("%s: %s" % (i, item)) return ' %s' % ', '.join(output) @@ -89,7 +89,7 @@ def main(): while len(args) > 0 and not(args[0].isdigit()): topic += " " + args.pop(0) - index = int(args.pop(0)) -1 if args else None + index = int(args.pop(0)) if args else None if options.search: search(topic, index) -- cgit v1.2.3