refactor(tw): Removed unused project_prefix_suffix config
This commit is contained in:
parent
444db318e7
commit
1217c2f5e4
@ -15,6 +15,9 @@
|
||||
"url": "https://git.aerex.me/Aerex/baikal-storage-plugin"
|
||||
}
|
||||
],
|
||||
"bin": [
|
||||
"bin/generateconfig"
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.5",
|
||||
"sabre/dav" : "~4.1.0",
|
||||
@ -26,7 +29,8 @@
|
||||
"symfony/config": "3.4",
|
||||
"symfony/process": "^3.4",
|
||||
"monolog/monolog": "^2.0",
|
||||
"symfony/yaml": "~3.0|~4.0"
|
||||
"symfony/yaml": "~3.0|~4.0",
|
||||
"symfony/console": "^3.4|^4.0|^5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.5.3"
|
||||
|
@ -4,4 +4,3 @@ logger:
|
||||
taskwarrior:
|
||||
taskdata: /home/aerex/.task
|
||||
taskrc: /home/aerex/.taskrc
|
||||
project_category_prefix: project_
|
||||
|
@ -17,10 +17,6 @@ class TaskwarriorConfig {
|
||||
->defaultValue('~/.taskrc')
|
||||
->info('The enivronment variable overrides the default and the command line specification of the .taskrc file')
|
||||
->end()
|
||||
->scalarNode('project_category_prefix')
|
||||
->defaultValue('project_')
|
||||
->info('The word after the given prefix for a iCal category will be used to identify a task\'s project')
|
||||
->end()
|
||||
->end();
|
||||
|
||||
return $node;
|
||||
|
@ -33,11 +33,6 @@ class Taskwarrior implements IStorage {
|
||||
$html .= '<td>The environment variable overrides the default and the command line, and the "data.location" configuration setting of the task data directory</td>';
|
||||
$html .= '<td><input name="tw_taskdata" type="text" value="' . $this->configs['taskdata'] . '"></td>';
|
||||
$html .= '</tr>';
|
||||
$html .= '<tr>';
|
||||
$html .= '<th>project_category_prefix</th>';
|
||||
$html .= "<td>The word after the given prefix for a iCal category will be used to identify a task's project</td>";
|
||||
$html .= '<td><input name="tw_project_category_prefix" placeholder ="project_" name="tw_project_category_prefix" type="text" value="' . $this->configs['project_category_prefix'] . '"></td>';
|
||||
$html .= '</tr>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
@ -50,10 +45,6 @@ class Taskwarrior implements IStorage {
|
||||
$this->configs['taskdata'] = $postData['tw_taskdata'];
|
||||
}
|
||||
|
||||
if (isset($postData['tw_project_category_prefix'])){
|
||||
$this->configs['project_category_prefix'] = $postData['tw_project_category_prefix'];
|
||||
}
|
||||
|
||||
return $this->configs;
|
||||
|
||||
}
|
||||
@ -164,18 +155,8 @@ class Taskwarrior implements IStorage {
|
||||
}
|
||||
|
||||
if (isset($vtodo->CATEGORIES)) {
|
||||
$task['tags'] = [];
|
||||
foreach ($vtodo->CATEGORIES as $category) {
|
||||
if (isset($this->configs['project_category_prefix'])) {
|
||||
$projTagSuffixRegExp = sprintf('/^%s/', $this->configs['project_category_prefix']);
|
||||
if (preg_match($projTagSuffixRegExp, $category)) {
|
||||
$task['project'] = preg_replace($projTagSuffixRegExp, '', $category);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$task['tags'] = $category;
|
||||
}
|
||||
}
|
||||
$task['tags'] = $vtodo->CATEGORIES->getJsonValue();
|
||||
}
|
||||
|
||||
if (isset($vtodo->GEO)){
|
||||
$task['geo'] = $vtodo->GEO->getRawMimeDirValue();
|
||||
|
@ -40,8 +40,6 @@ class ConfigTest extends TestCase {
|
||||
$this->assertEquals($taskwarriorConfigs['taskrc'], '/home/aerex/.taskrc');
|
||||
$this->assertArrayHasKey('taskdata', $taskwarriorConfigs, 'taskwarrior config is missing taskdata property');
|
||||
$this->assertEquals($taskwarriorConfigs['taskdata'], '/home/aerex/.task');
|
||||
$this->assertArrayHasKey('project_category_prefix', $taskwarriorConfigs, 'taskwarrior config is missing project_category_prefix property');
|
||||
$this->assertEquals($taskwarriorConfigs['project_category_prefix'], 'project_');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,4 +6,3 @@ storages:
|
||||
taskwarrior:
|
||||
taskdata: /home/aerex/.task
|
||||
taskrc: /home/aerex/.taskrc
|
||||
project_category_prefix: project_
|
||||
|
Loading…
Reference in New Issue
Block a user