-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Adding ability to specify context with "@alias" names, just like dr…
…ush and provision 3.x. - Use this new ability to pre-load the context to pre-load Robo Command files from services! Issue #26 - Add docker:command, docker:logs, and docker:shell commands to Contexts that are using Docker.
- Loading branch information
Showing
12 changed files
with
221 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace Aegir\Provision\Console; | ||
|
||
use \Symfony\Component\Console\Input\ArgvInput as ArgvInputBase; | ||
use \Symfony\Component\Console\Input\InputDefinition; | ||
|
||
class ArgvInput extends ArgvInputBase { | ||
|
||
/** | ||
* @var string The name of the active context, extracted from the first argument if it has "@" prefix. | ||
*/ | ||
public $activeContextName = NULL; | ||
|
||
/** | ||
* @param array|null $argv An array of parameters from the CLI (in the argv format) | ||
* @param InputDefinition|null $definition A InputDefinition instance | ||
*/ | ||
public function __construct(array $argv = null, InputDefinition $definition = null) | ||
{ | ||
// If @alias is used, swap it out with --context= | ||
if (isset($argv[1]) && strpos($argv[1], '@') === 0) { | ||
$context_name = ltrim($argv[1], '@'); | ||
$argv[1] = "--context={$context_name}"; | ||
$this->activeContextName = $context_name; | ||
} | ||
// If --context option is used, use that. | ||
elseif ($argv_filtered = array_filter($argv, function ($key) { | ||
return strpos($key, '--context') === 0; | ||
})) { | ||
$context_option = array_pop($argv_filtered); | ||
$context_name = substr($context_option, strlen('--context=')); | ||
$this->activeContextName = $context_name; | ||
} | ||
parent::__construct($argv, $definition); | ||
} | ||
} |
Oops, something went wrong.