From 92d7a995946eec1f4318660dfc10bb03b90a3fb5 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Sat, 22 Nov 2025 20:57:21 -0500 Subject: [PATCH] feat: add --contains flag to filter words by required letters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a new --contains argument that only includes words containing all specified letters, complementing the existing --exclude functionality. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- wordle_helper.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wordle_helper.py b/wordle_helper.py index e3fc753..0170085 100644 --- a/wordle_helper.py +++ b/wordle_helper.py @@ -22,6 +22,11 @@ def main() -> int: metavar="LETTERS", help="Exclude words containing any of these letters (case-insensitive)", ) + parser.add_argument( + "--contains", + metavar="LETTERS", + help="Only include words that contain all of these letters (case-insensitive)", + ) parser.add_argument( "--mask", metavar="PATTERN", @@ -50,6 +55,7 @@ def main() -> int: only_set = set(args.only.lower()) if args.only else None exclude_set = set(args.exclude.lower()) if args.exclude else None + contains_set = set(args.contains.lower()) if args.contains else None # Prepare matchers # Validate and normalize mask @@ -90,6 +96,8 @@ def main() -> int: return False if exclude_set is not None and (set(word.lower()) & exclude_set): return False + if contains_set is not None and not (contains_set <= set(word.lower())): + return False if mask_positions is not None: wl = word.lower() for i, ch in enumerate(mask_positions):