From e3f9894331fabed3e1823234e13db28c79b4a60b Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 11 Dec 2025 14:43:42 +0800 Subject: [PATCH] Apply copilot's suggestion --- src/StaticPHP/Command/Dev/EnvCommand.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/StaticPHP/Command/Dev/EnvCommand.php b/src/StaticPHP/Command/Dev/EnvCommand.php index 2f2dbcf0..160504ed 100644 --- a/src/StaticPHP/Command/Dev/EnvCommand.php +++ b/src/StaticPHP/Command/Dev/EnvCommand.php @@ -15,7 +15,7 @@ class EnvCommand extends BaseCommand { public function configure(): void { - $this->addArgument('env', InputArgument::REQUIRED, 'The environment variable to show, if not set, all will be shown'); + $this->addArgument('env', InputArgument::OPTIONAL, 'The environment variable to show, if not set, all will be shown'); } public function initialize(InputInterface $input, OutputInterface $output): void @@ -31,6 +31,12 @@ class EnvCommand extends BaseCommand $this->output->writeln("Environment variable '{$env}' is not set."); return static::FAILURE; } + if (is_array($val)) { + foreach ($val as $k => $v) { + $this->output->writeln("{$k}={$v}"); + } + return static::SUCCESS; + } $this->output->writeln("{$val}"); return static::SUCCESS; }