diff options
-rwxr-xr-x | bladictionary.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/bladictionary.py b/bladictionary.py index 03ebb26..e7038b7 100755 --- a/bladictionary.py +++ b/bladictionary.py @@ -294,11 +294,10 @@ def get_sql(word): item.uses = rows items.append(item) + return items - return items - def main(): word, word_type, word_dict, options = parse_args() @@ -342,6 +341,17 @@ def main(): all_types = word_type is "" + #Normally we try and display 1 of each type if no type is specified + #But if the word only has one type of definition, display all of them + if all_types: + word_types = [] + for item in items: + if item.word_type not in word_types: + word_types.append(item.word_type) + if len(word_types) == 1: + word_type = word_types[0] + all_types = False + for item in items: #If no type is specified, we display one of each |