diff --git a/cambd/cambd.py b/cambd/cambd.py index 95030af..d267388 100755 --- a/cambd/cambd.py +++ b/cambd/cambd.py @@ -206,6 +206,19 @@ def main(word: str, show_all: bool, verbose: bool, dictionary: str): definitions, ) ) + + # If no definition found in the selected dictionary, grab from all + if len(wanted_definitions) == 0: + spinner.warn( + f"No word found in the {dictionary} dictionary." " Grabbing from all." + ) + wanted_definitions = list( + filter( + lambda want: want["DictionaryRegion"].lower() in ["us", "uk"], + definitions, + ) + ) + if not show_all: print_definition(word_filtered, wanted_definitions[0], True, verbose) else: