add project attr

This commit is contained in:
DavidBadura
2015-02-06 13:08:13 +01:00
parent 11c9f610a8
commit fa478272b6
5 changed files with 151 additions and 12 deletions

View File

@@ -50,6 +50,40 @@ class Taskwarrior
$this->command('done', $uuid);
}
/**
* @param array $params
* @param string|array $filter
*/
public function modify(array $params, $filter = null)
{
$options = [];
if (array_key_exists('due', $params)) {
$options[] = 'due:' . $params['due'];
}
if (array_key_exists('project', $params)) {
$options[] = 'project:' . $params['project'];
}
if (array_key_exists('description', $params)) {
$options[] = $params['description'];
}
$this->command('modify', $filter, $options);
}
/**
* @return array
* @throws TaskwarriorException
*/
public function projects()
{
$result = $this->command('_project');
return array_filter(explode("\n", $result), 'strlen');
}
/**
* @param $json
* @return string
@@ -64,6 +98,8 @@ class Taskwarrior
$output = $this->command('import', $file);
$fs->remove($file);
if (!preg_match('/([0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12})/', $output, $matches)) {
throw new TaskwarriorException();
}
@@ -123,6 +159,15 @@ class Taskwarrior
return $process->getOutput();
}
/**
* @return string
* @throws TaskwarriorException
*/
public function version()
{
return $this->command('_version');
}
/**
* @return ProcessBuilder
*/