88use Symfony \Component \Console \Input \InputArgument ;
99use Symfony \Component \Console \Input \InputOption ;
1010use PHPCR \PropertyType ;
11+ use PHPCR \Util \UUIDHelper ;
1112
1213class NodeListCommand extends Command
1314{
@@ -19,7 +20,7 @@ class NodeListCommand extends Command
1920 protected function configure ()
2021 {
2122 $ this ->setName ('node:list ' );
22- $ this ->setDescription ('List the children / properties of this node ' );
23+ $ this ->setDescription ('List the children / properties of this node at the given path or with the given UUID ' );
2324 $ this ->addArgument ('path ' , InputArgument::OPTIONAL , 'Path of node ' , '. ' );
2425 $ this ->addOption ('children ' , null , InputOption::VALUE_NONE , 'List only the children of this node ' );
2526 $ this ->addOption ('properties ' , null , InputOption::VALUE_NONE , 'List only the properties of this node ' );
@@ -33,6 +34,11 @@ protected function configure()
3334
3435The <info>node:list</info> command can also shows template nodes and properties as defined a nodes node-type by
3536using the <info>--template</info> option. Template nodes and properties are prefixed with the "@" symbol.
37+
38+ The command accepts wither a path (relative or absolute) to the node or a UUID.
39+
40+ PHPCRSH> node:list 842e61c0-09ab-42a9-87c0-308ccc90e6f4
41+ PHPCRSH> node:list /tests/foobar
3642HERE
3743 );
3844 }
@@ -50,8 +56,14 @@ public function execute(InputInterface $input, OutputInterface $output)
5056
5157 $ session = $ this ->getHelper ('phpcr ' )->getSession ();
5258
53- $ path = $ session ->getAbsPath ($ input ->getArgument ('path ' ));
54- $ currentNode = $ session ->getNode ($ path );
59+ $ path = $ input ->getArgument ('path ' );
60+
61+ if (true === UUIDHelper::isUUID ($ path )) {
62+ $ currentNode = $ session ->getNodeByIdentifier ($ path );
63+ } else {
64+ $ path = $ session ->getAbsPath ($ path );
65+ $ currentNode = $ session ->getNode ($ path );
66+ }
5567
5668 if (!$ this ->showChildren && !$ this ->showProperties ) {
5769 $ this ->showChildren = true ;
0 commit comments