mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-12 11:25:35 +08:00
Apply copilot's suggestion
This commit is contained in:
@@ -15,7 +15,7 @@ class EnvCommand extends BaseCommand
|
|||||||
{
|
{
|
||||||
public function configure(): void
|
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
|
public function initialize(InputInterface $input, OutputInterface $output): void
|
||||||
@@ -31,6 +31,12 @@ class EnvCommand extends BaseCommand
|
|||||||
$this->output->writeln("<error>Environment variable '{$env}' is not set.</error>");
|
$this->output->writeln("<error>Environment variable '{$env}' is not set.</error>");
|
||||||
return static::FAILURE;
|
return static::FAILURE;
|
||||||
}
|
}
|
||||||
|
if (is_array($val)) {
|
||||||
|
foreach ($val as $k => $v) {
|
||||||
|
$this->output->writeln("<info>{$k}={$v}</info>");
|
||||||
|
}
|
||||||
|
return static::SUCCESS;
|
||||||
|
}
|
||||||
$this->output->writeln("<info>{$val}</info>");
|
$this->output->writeln("<info>{$val}</info>");
|
||||||
return static::SUCCESS;
|
return static::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user