Skip to content

Option to show undefined proerties and children which are in the node type #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
# alpha2 / dev-master
Changelog
=========

## Features
alpha-3
-------

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

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

- `session:export:view`: Added `--pretty` option to `session:export:view` command to output formatted XML.
### Improvements

- [export]: `session:export:view`: Added `--pretty` option to `session:export:view` command to output formatted XML.
- `session:export:view`: Ask confirmation before overwriting file.
- [shell]: Autocomplete completes property names in addition to node names in current path.

## Bugs
### Bugs

- Aliases: Allow quoted arguments
- Fixed autocomplete segfault
- [shell]: *Aliases*: Allow quoted arguments.
- [shell]: Fixed autocomplete segfault.
19 changes: 19 additions & 0 deletions features/phpcr_node_list.feature
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,22 @@ Feature: List properites and chidren of current node
| numberPropertyNode/ | nt:file | |
| NumberPropertyNodeToCompare1/ | nt:file | |
| NumberPropertyNodeToCompare2/ | nt:file | |


Scenario: List node hierarchy
Given the current node is "/"
And I execute the "node:list --level=1" command
Then the command should not fail
And I should see the following:
"""
daniel
"""

Scenario: Show templates
Given the current node is "/tests_general_base"
And I execute the "node:list --template" command
Then the command should not fail
And I should see the following:
"""
| @* | nt:base | |
"""
5 changes: 5 additions & 0 deletions features/shell_autocomplete.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Feature: Path autocompletion
In order to navigate the tree structure precisely and quickly
As a user logged into the shell
I need to be able to be able to invoke auto-completion

39 changes: 22 additions & 17 deletions src/PHPCR/Shell/Console/Command/Phpcr/NodeListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ protected function configure()
$this->addOption('properties', null, InputOption::VALUE_NONE, 'List only the properties of this node');
$this->addOption('filter', 'f', InputOption::VALUE_REQUIRED|InputOption::VALUE_IS_ARRAY, 'Optional filter to apply');
$this->addOption('level', 'L', InputOption::VALUE_REQUIRED, 'Depth of tree to show');
$this->addOption('no-template', 'T', InputOption::VALUE_REQUIRED, 'Do not show template nodes and properties');
$this->addOption('template', 't', InputOption::VALUE_NONE, 'Show template nodes and properties');
$this->setHelp(<<<HERE
List both or one of the children and properties of this node.

Multiple levels can be shown by using the <info>--level</info> option.

The <info>node:list</info> command also shows template nodes and properties as defined a nodes node-type.
These can be suppressed using the <info>--no-template</info> option.
The <info>node:list</info> command can also shows template nodes and properties as defined a nodes node-type by
using the <info>--template</info> option. Template nodes and properties are prefixed with the "@" symbol.
HERE
);
}
Expand All @@ -46,6 +46,7 @@ public function execute(InputInterface $input, OutputInterface $output)

$this->showChildren = $input->getOption('children');
$this->showProperties = $input->getOption('properties');
$this->showTemplate = $input->getOption('template');

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

Expand Down Expand Up @@ -113,14 +114,16 @@ private function renderChildren($currentNode, $table, $spacers)
}
}

// render empty schematic children
foreach ($childNodeNames as $childNodeName => $childNodeDefinition) {
// @todo: Determine and show cardinality, 1..*, *..*, 0..1, etc.
$table->addRow(array(
'<templatenode>' . implode('', $spacers) . '@' . $childNodeName . '</templatenode>',
implode('|', $childNodeDefinition->getRequiredPrimaryTypeNames()),
'',
));
if ($this->showTemplate) {
// render empty schematic children
foreach ($childNodeNames as $childNodeName => $childNodeDefinition) {
// @todo: Determine and show cardinality, 1..*, *..*, 0..1, etc.
$table->addRow(array(
'<templatenode>' . implode('', $spacers) . '@' . $childNodeName . '</templatenode>',
implode('|', $childNodeDefinition->getRequiredPrimaryTypeNames()),
'',
));
}
}
}

Expand Down Expand Up @@ -150,12 +153,14 @@ private function renderProperties($currentNode, $table, $spacers)
));
}

foreach ($propertyNames as $propertyName => $property) {
$table->addRow(array(
'<templateproperty>' . implode('', $spacers). '@' . $propertyName . '</templateproperty>',
'<property-type>' . strtoupper(PropertyType::nameFromValue($property->getRequiredType())) . '</property-type>',
''
));
if ($this->showTemplate) {
foreach ($propertyNames as $propertyName => $property) {
$table->addRow(array(
'<templateproperty>' . implode('', $spacers). '@' . $propertyName . '</templateproperty>',
'<property-type>' . strtoupper(PropertyType::nameFromValue($property->getRequiredType())) . '</property-type>',
''
));
}
}
}
}