feat(tw): Added project_tag_suffix config to use tag for tw project

This commit is contained in:
Aerex
2020-05-28 11:54:21 -05:00
parent 9d78b4a8eb
commit 346e5c239b
13 changed files with 199 additions and 96 deletions

View File

@@ -9,10 +9,10 @@ use Symfony\Component\Yaml\Yaml;
class ConfigBuilder implements ConfigurationInterface {
private $configs = [];
private $configDir;
private $configFile;
public function __construct($configDir) {
$this->configDir = $configDir;
public function __construct($configFile) {
$this->configFile = $configFile;
$this->processor = new Processor();
}
@@ -23,7 +23,20 @@ class ConfigBuilder implements ConfigurationInterface {
public function getConfigTreeBuilder() {
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('configs');
$ref = $rootNode->children();
$ref = $rootNode->children()
->arrayNode('logger')
->canBeEnabled()
->children()
->scalarNode('file')
->end()
->scalarNode('level')
->defaultValue('ERROR')
->validate()
->IfNotInArray(['DEBUG', 'INFO', 'NOTICE', 'WARNING', 'ERROR', 'CRITICAL', 'ALERT', 'EMERGENCY'])
->thenInvalid('Invalid log level %s')
->end()
->end();
foreach ($this->configs as $config) {
$ref = $ref->append($config->get());
}
@@ -32,8 +45,7 @@ class ConfigBuilder implements ConfigurationInterface {
}
public function readContent() {
$contents = sprintf('%s/storage.yaml', $this->configDir);
return file_get_contents($contents);
return file_get_contents($this->configFile);
}
public function loadYaml() {

View File

@@ -15,6 +15,9 @@ class TaskwarriorConfig {
->scalarNode('taskrc')
->defaultValue('~/.taskrc')
->end()
->scalarNode('project_tag_suffix')
->defaultValue('project_')
->end()
->end();
return $node;