|
4 | 4 |
|
5 | 5 | use Symfony\Component\Console\Application; |
6 | 6 | use PHPCR\SessionInterface; |
| 7 | + |
7 | 8 | use Symfony\Component\Console\Input\InputInterface; |
8 | 9 | use Symfony\Component\Console\Output\OutputInterface; |
9 | | -use PHPCR\Shell\Console\Command\AbstractSessionCommand; |
10 | | -use PHPCR\Shell\Console\Command\Workspace\SelectCommand; |
11 | | -use PHPCR\Shell\Console\Command\Workspace\NodeTypeListCommand; |
| 10 | + |
12 | 11 | use PHPCR\Util\Console\Helper\PhpcrConsoleDumperHelper; |
13 | | -use PHPCR\Shell\Console\Command\Workspace\NodeDumpCommand; |
14 | 12 | use PHPCR\Shell\Console\Helper\ResultFormatterHelper; |
| 13 | +use PHPCR\Util\Console\Helper\PhpcrHelper; |
| 14 | +use PHPCR\Util\Console\Helper\PhpcrCliHelper; |
| 15 | +use PHPCR\Util\Console\Command\NodeDumpCommand; |
| 16 | +use PHPCR\Shell\Console\Command\Query\SelectCommand; |
| 17 | +use PHPCR\Util\Console\Command\NodeMoveCommand; |
| 18 | +use PHPCR\Util\Console\Command\NodeRemoveCommand; |
| 19 | +use PHPCR\Util\Console\Command\NodesUpdateCommand; |
| 20 | +use PHPCR\Util\Console\Command\NodeTouchCommand; |
| 21 | +use PHPCR\Util\Console\Command\NodeTypeListCommand; |
| 22 | +use PHPCR\Util\Console\Command\NodeTypeRegisterCommand; |
| 23 | +use PHPCR\Util\Console\Command\WorkspaceCreateCommand; |
| 24 | +use PHPCR\Util\Console\Command\WorkspaceDeleteCommand; |
| 25 | +use PHPCR\Util\Console\Command\WorkspaceExportCommand; |
| 26 | +use PHPCR\Util\Console\Command\WorkspaceImportCommand; |
| 27 | +use PHPCR\Util\Console\Command\WorkspaceListCommand; |
| 28 | +use PHPCR\Util\Console\Command\WorkspacePurgeCommand; |
| 29 | +use Symfony\Component\Console\Command\Command; |
| 30 | +use PHPCR\Shell\Console\Command\Shell\ChangePathCommand; |
| 31 | +use PHPCR\Shell\Console\Command\Shell\PwdCommand; |
15 | 32 |
|
16 | 33 | class ShellApplication extends Application |
17 | 34 | { |
| 35 | + protected $cwd; |
| 36 | + |
| 37 | + public function getCwd() |
| 38 | + { |
| 39 | + return $this->cwd; |
| 40 | + } |
| 41 | + |
| 42 | + public function setCwd($cwd) |
| 43 | + { |
| 44 | + $this->cwd = $cwd; |
| 45 | + } |
| 46 | + |
18 | 47 | public function __construct(SessionInterface $session) |
19 | 48 | { |
20 | 49 | parent::__construct('PHPCR', '1.0'); |
21 | 50 |
|
22 | 51 | $this->add(new SelectCommand()); |
23 | | - $this->add(new NodeTypeListCommand()); |
24 | | - $this->add(new NodeDumpCommand()); |
| 52 | + $this->add(new ChangePathCommand()); |
| 53 | + $this->add(new PwdCommand()); |
| 54 | + |
| 55 | + $this->add($this->wrap(new NodeDumpCommand()) |
| 56 | + ->setName('ls') |
| 57 | + ->setDescription('Alias for dump') |
| 58 | + ); |
| 59 | + $this->add($this->wrap(new NodeMoveCommand()) |
| 60 | + ->setName('mv') |
| 61 | + ); |
| 62 | + $this->add($this->wrap(new NodeRemoveCommand()) |
| 63 | + ->setName('rm') |
| 64 | + ); |
| 65 | + $this->add($this->wrap(new NodesUpdateCommand()) |
| 66 | + ->setName('update') |
| 67 | + ); |
| 68 | + $this->add($this->wrap(new NodeTouchCommand()) |
| 69 | + ->setName('touch') |
| 70 | + ); |
| 71 | + $this->add($this->wrap(new NodeTypeListCommand()) |
| 72 | + ->setName('nt-list') |
| 73 | + ); |
| 74 | + $this->add($this->wrap(new NodeTypeRegisterCommand()) |
| 75 | + ->setName('nt-register') |
| 76 | + ); |
| 77 | + $this->add($this->wrap(new WorkspaceCreateCommand()) |
| 78 | + ->setName('workspace-create') |
| 79 | + ); |
| 80 | + $this->add($this->wrap(new WorkspaceDeleteCommand()) |
| 81 | + ->setName('workspace-delete') |
| 82 | + ); |
| 83 | + $this->add($this->wrap(new WorkspaceExportCommand()) |
| 84 | + ->setName('workspace-export') |
| 85 | + ); |
| 86 | + $this->add($this->wrap(new WorkspaceImportCommand()) |
| 87 | + ->setName('workspace-import') |
| 88 | + ); |
| 89 | + $this->add($this->wrap(new WorkspaceListCommand()) |
| 90 | + ->setName('workspace-list') |
| 91 | + ); |
| 92 | + $this->add($this->wrap(new WorkspacePurgeCommand()) |
| 93 | + ->setName('workspace-purge') |
| 94 | + ); |
25 | 95 |
|
26 | 96 | $this->getHelperSet()->set(new PhpcrConsoleDumperHelper()); |
27 | 97 | $this->getHelperSet()->set(new ResultFormatterHelper()); |
| 98 | + $this->getHelperSet()->set(new PhpcrHelper($session)); |
| 99 | + $this->getHelperSet()->set(new PhpcrCliHelper($session)); |
28 | 100 |
|
29 | 101 | foreach ($this->all() as $command) { |
30 | 102 | if ($command instanceof AbstractSessionCommand) { |
31 | 103 | $command->setSession($session); |
32 | 104 | } |
33 | 105 | } |
34 | 106 | } |
| 107 | + |
| 108 | + public function wrap(Command $command) |
| 109 | + { |
| 110 | + return $command; |
| 111 | + } |
35 | 112 | } |
0 commit comments