diff options
author | Alasdair <alnessy@hotmail.com> | 2013-08-23 19:35:31 +0200 |
---|---|---|
committer | Alasdair <alnessy@hotmail.com> | 2013-08-23 19:35:31 +0200 |
commit | fd72b60cfd6f84545b6c8ec5d7396a29356c7fbb (patch) | |
tree | 2d2f564c26c2744116594a96640c06d8a2d40498 | |
parent | 14cc7fe8d974e92e1022064ef90f6d22a98fe23f (diff) |
now print summary if --search has only one result
-rwxr-xr-x | wikiquery | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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 |