This repository has been archived by the owner on Aug 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
SmetDenis
committed
Jul 9, 2018
1 parent
db4e661
commit cbae096
Showing
5 changed files
with
86 additions
and
28 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,49 @@ | ||
<?php | ||
/** | ||
* JBZoo TeamcityKeyKeeper | ||
* | ||
* This file is part of the JBZoo CCK package. | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package TeamcityKeyKeeper | ||
* @license MIT | ||
* @copyright Copyright (C) JBZoo.com, All rights reserved. | ||
* @link https://github.com/JBZoo/TeamcityKeyKeeper | ||
*/ | ||
|
||
namespace JBZoo\TeamcityKeyKeeper; | ||
|
||
use JBZoo\Data\JSON; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
/** | ||
* Class KeyGetCommand | ||
* @package JBZoo\TeamcityKeyKeeper | ||
*/ | ||
class KeyGetCommand extends Command | ||
{ | ||
protected function configure() | ||
{ | ||
$this | ||
->setName('key:get') | ||
->addOption('name', null, InputOption::VALUE_REQUIRED, 'Name of key') | ||
->addOption('group', null, InputOption::VALUE_OPTIONAL, 'Group of keys', 'default') | ||
->setDescription('Get clean value of key'); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$name = strtoupper(trim($input->getOption('name'))); | ||
$group = trim($input->getOption('group')); | ||
|
||
$storage = new JSON(realpath(PATH_STORAGE . "/{$group}.json") ?: []); | ||
$output->write(trim($storage->get($name)) ?: ''); | ||
} | ||
} |
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