From fd72b60cfd6f84545b6c8ec5d7396a29356c7fbb Mon Sep 17 00:00:00 2001 From: Alasdair Date: Fri, 23 Aug 2013 19:35:31 +0200 Subject: now print summary if --search has only one result --- wikiquery | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wikiquery b/wikiquery index 388b2f7..0597cd9 100755 --- a/wikiquery +++ b/wikiquery @@ -24,7 +24,11 @@ def main(): sys.exit(0) if args.search: - print wikipedia.search(args.topic) + results = wikipedia.search(args.topic) + if len(results) == 1: + print wikipedia.summary(results[0]) + else: + print results elif args.url: page = wikipedia.page(args.topic) print page.url -- cgit v1.2.3