Skip to content

Commit 910300f

Browse files
committed
Node list show templates
- Behat tests - Now must be enabled explicitly
1 parent 25e12ff commit 910300f

File tree

4 files changed

+61
-27
lines changed

4 files changed

+61
-27
lines changed

CHANGELOG.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
# alpha2 / dev-master
1+
Changelog
2+
=========
23

3-
## Features
4+
alpha-3
5+
-------
46

5-
- New command: `file:import`: - import files into the repository.
6-
- `node:list`: Added `--level` option to rescursively show children nodes and properties
7-
- Autocomplete completes property names in addition to node names in current path
7+
### Features
88

9-
## Improvements
9+
- [file]: `file:import` - New command to import files into the repository.
10+
- [node]: `node:list` Added `--level` option to rescursively show children nodes and properties.
11+
- [node]: `node:list` Show "unulfilled" property and child node definitions when listing node contents.
1012

11-
- `session:export:view`: Added `--pretty` option to `session:export:view` command to output formatted XML.
13+
### Improvements
14+
15+
- [export]: `session:export:view`: Added `--pretty` option to `session:export:view` command to output formatted XML.
1216
- `session:export:view`: Ask confirmation before overwriting file.
17+
- [shell]: Autocomplete completes property names in addition to node names in current path.
1318

14-
## Bugs
19+
### Bugs
1520

16-
- Aliases: Allow quoted arguments
17-
- Fixed autocomplete segfault
21+
- [shell]: *Aliases*: Allow quoted arguments.
22+
- [shell]: Fixed autocomplete segfault.

features/phpcr_node_list.feature

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,22 @@ Feature: List properites and chidren of current node
4141
| numberPropertyNode/ | nt:file | |
4242
| NumberPropertyNodeToCompare1/ | nt:file | |
4343
| NumberPropertyNodeToCompare2/ | nt:file | |
44+
45+
46+
Scenario: List node hierarchy
47+
Given the current node is "/"
48+
And I execute the "node:list --level=1" command
49+
Then the command should not fail
50+
And I should see the following:
51+
"""
52+
daniel
53+
"""
54+
55+
Scenario: Show templates
56+
Given the current node is "/tests_general_base"
57+
And I execute the "node:list --template" command
58+
Then the command should not fail
59+
And I should see the following:
60+
"""
61+
| @* | nt:base | |
62+
"""

features/shell_autocomplete.feature

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Feature: Path autocompletion
2+
In order to navigate the tree structure precisely and quickly
3+
As a user logged into the shell
4+
I need to be able to be able to invoke auto-completion
5+

src/PHPCR/Shell/Console/Command/Phpcr/NodeListCommand.php

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ protected function configure()
2525
$this->addOption('properties', null, InputOption::VALUE_NONE, 'List only the properties of this node');
2626
$this->addOption('filter', 'f', InputOption::VALUE_REQUIRED|InputOption::VALUE_IS_ARRAY, 'Optional filter to apply');
2727
$this->addOption('level', 'L', InputOption::VALUE_REQUIRED, 'Depth of tree to show');
28-
$this->addOption('no-template', 'T', InputOption::VALUE_REQUIRED, 'Do not show template nodes and properties');
28+
$this->addOption('template', 't', InputOption::VALUE_NONE, 'Show template nodes and properties');
2929
$this->setHelp(<<<HERE
3030
List both or one of the children and properties of this node.
3131
3232
Multiple levels can be shown by using the <info>--level</info> option.
3333
34-
The <info>node:list</info> command also shows template nodes and properties as defined a nodes node-type.
35-
These can be suppressed using the <info>--no-template</info> option.
34+
The <info>node:list</info> command can also shows template nodes and properties as defined a nodes node-type by
35+
using the <info>--template</info> option. Template nodes and properties are prefixed with the "@" symbol.
3636
HERE
3737
);
3838
}
@@ -46,6 +46,7 @@ public function execute(InputInterface $input, OutputInterface $output)
4646

4747
$this->showChildren = $input->getOption('children');
4848
$this->showProperties = $input->getOption('properties');
49+
$this->showTemplate = $input->getOption('template');
4950

5051
$session = $this->getHelper('phpcr')->getSession();
5152

@@ -113,14 +114,16 @@ private function renderChildren($currentNode, $table, $spacers)
113114
}
114115
}
115116

116-
// render empty schematic children
117-
foreach ($childNodeNames as $childNodeName => $childNodeDefinition) {
118-
// @todo: Determine and show cardinality, 1..*, *..*, 0..1, etc.
119-
$table->addRow(array(
120-
'<templatenode>' . implode('', $spacers) . '@' . $childNodeName . '</templatenode>',
121-
implode('|', $childNodeDefinition->getRequiredPrimaryTypeNames()),
122-
'',
123-
));
117+
if ($this->showTemplate) {
118+
// render empty schematic children
119+
foreach ($childNodeNames as $childNodeName => $childNodeDefinition) {
120+
// @todo: Determine and show cardinality, 1..*, *..*, 0..1, etc.
121+
$table->addRow(array(
122+
'<templatenode>' . implode('', $spacers) . '@' . $childNodeName . '</templatenode>',
123+
implode('|', $childNodeDefinition->getRequiredPrimaryTypeNames()),
124+
'',
125+
));
126+
}
124127
}
125128
}
126129

@@ -150,12 +153,14 @@ private function renderProperties($currentNode, $table, $spacers)
150153
));
151154
}
152155

153-
foreach ($propertyNames as $propertyName => $property) {
154-
$table->addRow(array(
155-
'<templateproperty>' . implode('', $spacers). '@' . $propertyName . '</templateproperty>',
156-
'<property-type>' . strtoupper(PropertyType::nameFromValue($property->getRequiredType())) . '</property-type>',
157-
''
158-
));
156+
if ($this->showTemplate) {
157+
foreach ($propertyNames as $propertyName => $property) {
158+
$table->addRow(array(
159+
'<templateproperty>' . implode('', $spacers). '@' . $propertyName . '</templateproperty>',
160+
'<property-type>' . strtoupper(PropertyType::nameFromValue($property->getRequiredType())) . '</property-type>',
161+
''
162+
));
163+
}
159164
}
160165
}
161166
}

0 commit comments

Comments
 (0)