Skip to content

Commit 7eedc6e

Browse files
nvakenjmolivas
authored andcommitted
Allow users to define a specific property that they want from a site (#153)
1 parent 8986c38 commit 7eedc6e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/Command/Site/DebugCommand.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ public function configure()
5656
$this->trans('commands.site.debug.options.target'),
5757
null
5858
)
59+
->addArgument(
60+
'property',
61+
InputArgument::OPTIONAL,
62+
$this->trans('commands.site.debug.options.property'),
63+
null
64+
)
5965
->setHelp($this->trans('commands.site.debug.help'));
6066
}
6167

@@ -74,6 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7480
return 1;
7581
}
7682

83+
7784
// --target argument
7885
$target = $input->getArgument('target');
7986
if (!$target) {
@@ -93,6 +100,20 @@ protected function execute(InputInterface $input, OutputInterface $output)
93100
return 1;
94101
}
95102

103+
// --property argument, allows the user to fetch specific properties of the selected site
104+
$property = $input->getArgument('property');
105+
if ($property) {
106+
$property_keys = explode('.', $property);
107+
108+
$val = $targetConfig;
109+
foreach ($property_keys as $property_key) {
110+
$val = &$val[$property_key];
111+
}
112+
113+
$io->writeln($val);
114+
return 0;
115+
}
116+
96117
$io->info($target);
97118
$dumper = new Dumper();
98119
$io->writeln($dumper->dump($targetConfig, 2));

0 commit comments

Comments
 (0)