Skip to content

Workspace is first argument #122

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
Dec 19, 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
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ Changelog
dev-master
----------

### Bug fixes

- [config] Do not override CLI options with profile options

### Features

- [cli] Specify workspace with first argument
- [global] Refactored to use DI container and various general improvements
- [references] Show UUIDs when listing reference properties
- [transport] Added transport layer for experimental Jackalope FS implementation
- [misc] Wildcard (single asterisk) support in paths
- [node] Added wilcard support to applicable node commands, including "node:list", "node:remove" and "node:property:show"
- [global] Refactored to use DI container and various general improvements
- [node:references] Shows the referencing node paths instead of the referrered-to node path(s)

alpha-6
Expand Down
4 changes: 3 additions & 1 deletion src/PHPCR/Shell/Console/Command/ShellCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use PHPCR\Shell\Console\Application\ShellApplication;
use PHPCR\Shell\Console\Application\Shell;
use PHPCR\Shell\Console\Input\StringInput;
use Symfony\Component\Console\Input\InputArgument;

/**
* The shell command is the command used to configure the shell session
Expand Down Expand Up @@ -51,7 +52,6 @@ public function configure()
new InputOption('--transport', '-t', InputOption::VALUE_REQUIRED, 'Transport to use.'),
new InputOption('--phpcr-username', '-pu', InputOption::VALUE_REQUIRED, 'PHPCR Username.', 'admin'),
new InputOption('--phpcr-password', '-pp', InputOption::VALUE_OPTIONAL, 'PHPCR Password.', 'admin'),
new InputOption('--phpcr-workspace','-pw', InputOption::VALUE_OPTIONAL, 'PHPCR Workspace.', 'default'),
new InputOption('--db-username', '-du', InputOption::VALUE_REQUIRED, 'Database Username.', 'root'),
new InputOption('--db-name', '-dn', InputOption::VALUE_REQUIRED, 'Database Name.', 'phpcr'),
new InputOption('--db-password', '-dp', InputOption::VALUE_OPTIONAL, 'Database Password.'),
Expand All @@ -65,6 +65,8 @@ public function configure()
new InputOption('--profile', '-p', InputOption::VALUE_OPTIONAL, 'Speicfy a profile name, use wit <info>--transport</info> to update or create'),
new InputOption('--unsupported', null, InputOption::VALUE_NONE, 'Show all commands, including commands not supported by the repository'),
new InputOption('--command', null, InputOption::VALUE_REQUIRED|InputOption::VALUE_IS_ARRAY, 'Run the given command'),

new InputArgument('workspace', InputArgument::OPTIONAL, 'Workspace to start with', 'default'),
));
}

Expand Down
17 changes: 8 additions & 9 deletions src/PHPCR/Shell/DependencyInjection/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ public function registerPhpcr()
public function registerEvent()
{
if ($this->mode === self::MODE_STANDALONE) {
$this->register(
'event.subscriber.profile_loader',
'PHPCR\Shell\Subscriber\ProfileLoaderSubscriber'
)
->addArgument(new Reference('config.profile_loader'))
->addArgument(new Reference('helper.question'))
->addTag('event.subscriber');

$this->register(
'event.subscriber.profile_from_session_input',
'PHPCR\Shell\Subscriber\ProfileFromSessionInputSubscriber'
Expand All @@ -109,21 +117,12 @@ public function registerEvent()
->addArgument(new Reference('helper.question'))
->addTag('event.subscriber');

$this->register(
'event.subscriber.profile_loader',
'PHPCR\Shell\Subscriber\ProfileLoaderSubscriber'
)
->addArgument(new Reference('config.profile_loader'))
->addArgument(new Reference('helper.question'))
->addTag('event.subscriber');

$this->register(
'event.subscriber.config_init',
'PHPCR\Shell\Subscriber\ConfigInitSubscriber'
)
->addArgument(new Reference('config.manager'))
->addTag('event.subscriber');

}

$this->register(
Expand Down
15 changes: 14 additions & 1 deletion src/PHPCR/Shell/Subscriber/ProfileFromSessionInputSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ public function handleProfileInit(ProfileInitEvent $e)
$phpcrOptions = array(
'phpcr-username' => 'username',
'phpcr-password' => 'password',
'phpcr-workspace' => 'workspace',
);

foreach ($transportOptions as $optionName => $configName) {
$value = $input->getOption($optionName);

if (!$value) {
continue;
}

if (null !== $value) {
// sanitize some input values
switch ($optionName) {
Expand All @@ -61,7 +64,17 @@ public function handleProfileInit(ProfileInitEvent $e)
$profile->set('transport', $configName, (string) $value);
}

$workspace = $input->getArgument('workspace');

if ($workspace) {
$profile->set('phpcr', 'workspace', $workspace);
}

foreach ($phpcrOptions as $optionName => $configName) {
if (!$input->getOption($optionName)) {
continue;
}

$profile->set('phpcr', $configName, $input->getOption($optionName));
}
}
Expand Down