1313use Deployer \Deployer ;
1414use Deployer \Exception \WillAskUser ;
1515use Deployer \Task \Context ;
16+ use Maml \Maml ;
1617use Symfony \Component \Console \Input \InputInterface as Input ;
1718use Symfony \Component \Console \Input \InputOption ;
1819use 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