about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2021-01-24 21:02:39 +0530
committerAndinus <andinus@nand.sh>2021-01-24 21:02:39 +0530
commitae4d889f6a55b452e4b8eb6c6d955750f3ec90ed (patch)
tree9473d18e3ec130d0a54f5326405f77d1af124495
parent3b016917750c21dc5714eb1c06628d359f06aee1 (diff)
downloadoctans-ae4d889f6a55b452e4b8eb6c6d955750f3ec90ed.tar.gz
Add an option to specify minimum length
-rw-r--r--lib/Octans/CLI.rakumod5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Octans/CLI.rakumod b/lib/Octans/CLI.rakumod
index 075a57f..04e1b5d 100644
--- a/lib/Octans/CLI.rakumod
+++ b/lib/Octans/CLI.rakumod
@@ -12,6 +12,7 @@ multi sub MAIN (
     Str $path?, #= path to the crossword (file or url)
     Str :$dict = (%?RESOURCES<mwords/354984si.ngl> //
                   "/usr/share/dict/words").Str, #= dictionary file
+    Int :$length = 7, #= minimum word length (default: 7)
     Bool :s($sample), #= run the sample puzzle
     Bool :v($verbose), #= increase verbosity
     Bool :$version, #= print version
@@ -23,8 +24,8 @@ multi sub MAIN (
     }
 
     # @dict holds the sorted dictionary. Only consider words >= 7
-    # chars.
-    my Str @dict = $dict.IO.lines.grep(*.chars >= 7);
+    # chars by default.
+    my Str @dict = $dict.IO.lines.grep(*.chars >= $length);
 
     # @puzzle holds the puzzle.
     #