Use laravel prompts for the questions

This commit is contained in:
myrmidex 2026-08-22 20:51:50 +02:00
parent bdf707c296
commit 12bd79396f
3 changed files with 749 additions and 687 deletions

View file

@ -6,13 +6,15 @@ use Lvl0\AnagramFinder\Core\Matcher;
use Lvl0\AnagramFinder\TUI\ArgHandler; use Lvl0\AnagramFinder\TUI\ArgHandler;
use Lvl0\AnagramFinder\TUI\Output; use Lvl0\AnagramFinder\TUI\Output;
use function Laravel\Prompts\text;
const DICTIONARY = __DIR__ . '/../assets/words.txt'; const DICTIONARY = __DIR__ . '/../assets/words.txt';
Output::line("ANAGRAM FINDER"); Output::line("ANAGRAM FINDER");
$args = ArgHandler::make($argv); $args = ArgHandler::make($argv);
$anagram = $args->get(1) ?: readline("Enter the anagram: "); $anagram = $args->get(1) ?: text("Enter the anagram", required: true);
$minLength = $args->get(2) ?: 3; $minLength = $args->get(2) ?: text(label: "Enter the minimum length of the results. (default=3)", placeholder: 3, default: 3, required: true);
$top10 = $args->hasOption('top'); $top10 = $args->hasOption('top');
Output::line(); Output::line();

View file

@ -4,7 +4,8 @@
"type": "project", "type": "project",
"require": { "require": {
"anagram-finder/core": "^0.1.0", "anagram-finder/core": "^0.1.0",
"illuminate/collections": "^13.26" "illuminate/collections": "^13.26",
"laravel/prompts": "^0.3.23"
}, },
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"autoload": { "autoload": {

1427
composer.lock generated

File diff suppressed because it is too large Load diff