tokens = []
else:
tokens = argument.split(" ")
- if len(tokens) != 0:
- if (len(tokens) == 1 and not tokens[0].isdigit()) or \
- tokens[0] not in {"search", "offset-search"} or \
- (tokens[0] == "offset-search" and
- ((not len(tokens) > 2) or (not tokens[1].isdigit()))):
- help()
- return
+ if (len(tokens) == 1 and not tokens[0].isdigit()) or \
+ (len(tokens) > 1 and
+ (tokens[0] not in {"search", "offset-search"}) or
+ (tokens[0] == "offset-search" and
+ ((not len(tokens) > 2) or (not tokens[1].isdigit())))):
+ help()
+ return
if not os.access(session.quotesfile, os.F_OK):
notice("no quotes available")
return
notice("there's no quote of that index")
return
i = i - 1
- else:
+ elif len(tokens) > 1:
to_skip = 0
if tokens[0] == "search":
query = str.join(" ", tokens[1:])
notice("skipped all quotes matching query")
else:
notice("found %s matches, showing max. 3, skipping %s"
- %s (len(results), to_skip))
+ % (len(results), to_skip))
for i in range(len(results)):
if i >= to_skip and i < to_skip + 3:
result = results[i]