never mind minLength if --top enabled + delete obsolete files

This commit is contained in:
myrmidex 2026-08-22 22:42:58 +02:00
parent 5e1da51506
commit 1d1f953fab
3 changed files with 4 additions and 48 deletions

View file

@ -1,34 +0,0 @@
<?php
namespace Lvl0\AnagramFinder\TUI;
use Illuminate\Support\Collection;
class ArgHandler
{
private Collection $args;
public function __construct(array $argv)
{
$this->args = new Collection($argv);
}
public static function make(array $argv): self
{
return new self($argv);
}
public function get(int $index)
{
return $this->args
->reject(fn($word) => substr($word, 0, 2) === '--')
->get($index);
}
public function hasOption(string $option)
{
return $this->args
->filter(fn($word) => $word === '--' . $option)
->isNotEmpty();
}
}

View file

@ -30,13 +30,15 @@ class FindAnagramWordsCommand extends Command
info("ANAGRAM FINDER");
$anagram = $anagram ??= text("Enter the anagram", required: true);
$minLength = $minLength ?: text(label: "Enter the minimum length of the results. (default=3)", placeholder: 3, default: 3, required: true);
$minLength = $top === true
? 3
: ($minLength ?: text(label: "Enter the minimum length of the results. (default=3)", placeholder: 3, default: 3, required: true));
info("Results for your anagram: " . $anagram);
$matches = spin(
callback: fn() => Matcher::findWords($anagram, $minLength),
message: 'Checking wordlist...',
message: 'Checking dictionary...',
);
if ($top) {

View file

@ -1,12 +0,0 @@
<?php
namespace Lvl0\AnagramFinder\TUI;
class Output
{
public static function line(string $message = ''): void
{
print($message . PHP_EOL);
flush();
}
}