Skip to content

[make:security:custom] no interaction for make:security:custom #1594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 1.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Maker/Security/MakeCustomAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Symfony\Bundle\MakerBundle\Util\YamlSourceManipulator;
use Symfony\Bundle\MakerBundle\Validator;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -68,8 +69,10 @@ public static function getCommandDescription(): string
public function configureCommand(Command $command, InputConfiguration $inputConfig): void
{
$command
->addArgument('name', InputArgument::OPTIONAL, 'The class name of the authenticator (e.g. <fg=yellow>CustomAuthenticator</>)')
->setHelp($this->getHelpFileContents('security/MakeCustom.txt'))
;
$inputConfig->setArgumentAsNonInteractive('name');
}

public function interact(InputInterface $input, ConsoleStyle $io, Command $command): void
Expand All @@ -84,7 +87,7 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
throw new RuntimeCommandException(\sprintf('The file "%s" does not exist. PHP & XML configuration formats are currently not supported.', self::SECURITY_CONFIG_PATH));
}

$name = $io->ask(
$name = $input->getArgument('name') ?? $io->ask(
question: 'What is the class name of the authenticator (e.g. <fg=yellow>CustomAuthenticator</>)',
validator: static function (mixed $answer) {
return Validator::notBlank($answer);
Expand Down
Loading