Skip to content

Commit e3f9894

Browse files
committed
Apply copilot's suggestion
1 parent 6d292b4 commit e3f9894

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/StaticPHP/Command/Dev/EnvCommand.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class EnvCommand extends BaseCommand
1515
{
1616
public function configure(): void
1717
{
18-
$this->addArgument('env', InputArgument::REQUIRED, 'The environment variable to show, if not set, all will be shown');
18+
$this->addArgument('env', InputArgument::OPTIONAL, 'The environment variable to show, if not set, all will be shown');
1919
}
2020

2121
public function initialize(InputInterface $input, OutputInterface $output): void
@@ -31,6 +31,12 @@ public function handle(): int
3131
$this->output->writeln("<error>Environment variable '{$env}' is not set.</error>");
3232
return static::FAILURE;
3333
}
34+
if (is_array($val)) {
35+
foreach ($val as $k => $v) {
36+
$this->output->writeln("<info>{$k}={$v}</info>");
37+
}
38+
return static::SUCCESS;
39+
}
3440
$this->output->writeln("<info>{$val}</info>");
3541
return static::SUCCESS;
3642
}

0 commit comments

Comments
 (0)