Skip to content

Commit

Permalink
Merge pull request #43 from kschroeder/develop
Browse files Browse the repository at this point in the history
Some CLI changes
  • Loading branch information
kschroeder authored Feb 23, 2017
2 parents 74ec495 + 49fefbf commit 5c7a505
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 8 additions & 3 deletions lib/Console/Command/ConfigurationListKeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
$groupId = (string)$parent[0]['id'];
$parent = $parent[0]->xpath('..');
$sectionId = (string)$parent[0]['id'];
$description = '';
$default = '';
if (isset($element->value)) {
$default = sprintf(' (default: %s) ', (string)$element->value);
}
if (isset($element->description)) {
$description = sprintf("\n (%s)", (string)$element->description);
$description = sprintf("%s\n (%s)", $default, (string)$element->description);
} else {
$description = $default;
}

$out = sprintf('%s/%s/%s%s', $sectionId, $groupId, $elementId, $description);
$out = sprintf("%s/%s/%s%s\n", $sectionId, $groupId, $elementId, $description);
$output->writeln($out);

}
Expand Down
5 changes: 4 additions & 1 deletion tests/Command/ConfigurationListKeysTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ public function testStructure()
<configuration xmlns="http://www.magiumlib.com/Configuration">
<section id="section">
<group id="group">
<element id="element2" />
<element id="element2">
<description>The description</description>
<value>default value</value>
</element>
</group>
</section>
</configuration>
Expand Down

0 comments on commit 5c7a505

Please sign in to comment.