-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Connects to #1711: Adding config:get and config:dump commmands. * Executing config:dump during CI.
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace Acquia\Blt\Robo\Commands\Blt; | ||
|
||
use Acquia\Blt\Robo\BltTasks; | ||
use Acquia\Blt\Robo\Exceptions\BltException; | ||
|
||
/** | ||
* Defines commands in the 'config:*' namespace. | ||
*/ | ||
class ConfigCommand extends BltTasks { | ||
|
||
/** | ||
* Gets the value of a config variable. | ||
* | ||
* @command config:get | ||
* | ||
* @param string $key The key for the configuration item to get. | ||
* | ||
* @throws \Acquia\Blt\Robo\Exceptions\BltException | ||
*/ | ||
public function getValue($key) { | ||
if (!$this->getConfig()->has($key)) { | ||
throw new BltException("$key is not set."); | ||
} | ||
|
||
$this->say($this->getConfigValue($key)); | ||
} | ||
|
||
/** | ||
* Dumps all configuration values. | ||
* | ||
* @command config:dump | ||
*/ | ||
public function dump() { | ||
$config = $this->getConfig()->export(); | ||
$this->printArrayAsTable($config); | ||
} | ||
|
||
} |