diff options
Diffstat (limited to 'dfr.py')
-rwxr-xr-x | dfr.py | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -117,6 +117,8 @@ if __name__ == '__main__': parser.add_argument('-d', '--dico', dest='dico', action='store', help='the filename of the dictionnary', default='dfr.db') + parser.add_argument('-f', '--first', dest='first', action='store_true', + help='get only the first definition') parser.add_argument('-u', '--update', dest='update', type=str, nargs='?', const=dico, help='update the database') @@ -153,5 +155,13 @@ if __name__ == '__main__': if not ret: exit(1) else: - for w in arg.action(arg.word): - ui.show_terminal(w) + if arg.first: + a = arg.action(arg.word) + if a : + if a[0]['def']: + a[0]['def'] = [a[0]['def'][0]] + a[0]['def'][0]['ex'] = [] + ui.show_terminal(a[0]) + else: + for w in arg.action(arg.word): + ui.show_terminal(w) |