Skip to content

Commit bf49f6f

Browse files
committed
Add maml format support to ConfigCommand output
1 parent a946ca2 commit bf49f6f

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/Command/ConfigCommand.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Deployer\Deployer;
1414
use Deployer\Exception\WillAskUser;
1515
use Deployer\Task\Context;
16+
use Maml\Maml;
1617
use Symfony\Component\Console\Input\InputInterface as Input;
1718
use Symfony\Component\Console\Input\InputOption;
1819
use Symfony\Component\Console\Output\NullOutput;
@@ -30,7 +31,7 @@ public function __construct(Deployer $deployer)
3031
protected function configure(): void
3132
{
3233
parent::configure();
33-
$this->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (json, yaml)', 'yaml');
34+
$this->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (json, maml, yaml)', 'maml');
3435
$this->getDefinition()->getArgument('selector')->setDefault(['all']);
3536
}
3637

@@ -41,7 +42,9 @@ protected function execute(Input $input, Output $output): int
4142
$hosts = $this->selectHosts($input, $output);
4243
$data = [];
4344
$keys = $this->deployer->config->keys();
44-
define('DEPLOYER_NO_ASK', true);
45+
if (!defined('DEPLOYER_NO_ASK')) {
46+
define('DEPLOYER_NO_ASK', true);
47+
}
4548
foreach ($hosts as $host) {
4649
Context::push(new Context($host));
4750
$values = [];
@@ -67,6 +70,10 @@ protected function execute(Input $input, Output $output): int
6770
$output->writeln(json_encode($data, JSON_PRETTY_PRINT));
6871
break;
6972

73+
case 'maml':
74+
$output->writeln(Maml::stringify($data));
75+
break;
76+
7077
case 'yaml':
7178
$output->write(Yaml::dump($data));
7279
break;

0 commit comments

Comments
 (0)