Commit 5a841098 authored by Jon Pugh's avatar Jon Pugh

Ask for context type interactively if not specified!

parent 80bc398b
......@@ -51,8 +51,7 @@ class SaveCommand extends Command
'context_type',
null,
InputOption::VALUE_OPTIONAL,
'server, platform, or site; default server',
'server'
'server, platform, or site'
);
$inputDefinition[] = new InputOption(
'delete',
......@@ -85,6 +84,18 @@ class SaveCommand extends Command
$context = $this->getApplication()->getContext($input->getArgument('context_name'));
}
catch (\Exception $e) {
$context_name = $this->input->getArgument('context_name');
$this->io->comment("No context named '$context_name'. Creating a new one...");
if (empty($this->input->getOption('context_type'))) {
$context_type = $this->io->choice('Context Type?', [
'server',
'platform',
'site'
]);
$this->input->setOption('context_type', $context_type);
}
$properties = $this->askForContextProperties();
$context = new ServerContext($input->getArgument('context_name'), $this->getApplication()->getConfig()->all(), $properties);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment