summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFbenas <philbeansburton@gmail.com>2020-11-08 16:40:42 +0000
committerFbenas <philbeansburton@gmail.com>2020-11-08 16:40:42 +0000
commit8c1ba91f22696451b12176f52bc0224a85757de6 (patch)
treef08bda7edf917bd28937eb709d33bec489c67aa3
parent1bbb78e1e164cda9d2ba882653423504069106c3 (diff)
Fix index searching
-rwxr-xr-xwikiquery8
1 files 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)