mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-18 21:33:07 +02:00
completion: Fix compatibility with taskwarrior 2.4.4
This commit is contained in:
parent
6cedc13b58
commit
12d363df5e
2 changed files with 14 additions and 5 deletions
|
@ -1,6 +1,8 @@
|
||||||
from functools import reduce, wraps
|
from functools import reduce, wraps
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from tasklib import TaskWarrior
|
||||||
|
|
||||||
from taskwiki import constants
|
from taskwiki import constants
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,14 +55,20 @@ class Completion():
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def _tags(self):
|
def _tags(self):
|
||||||
return sorted(set(
|
if self.tw.version < TaskWarrior.VERSION_2_4_5:
|
||||||
tag
|
return sorted(self.tw.execute_command(['_tags']))
|
||||||
for tags in self.tw.execute_command(['_unique', 'tag'])
|
else:
|
||||||
for tag in tags.split(',')))
|
return sorted(set(
|
||||||
|
tag
|
||||||
|
for tags in self.tw.execute_command(['_unique', 'tag'])
|
||||||
|
for tag in tags.split(',')))
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def _projects(self):
|
def _projects(self):
|
||||||
return sorted(self.tw.execute_command(['_unique', 'project']))
|
if self.tw.version < TaskWarrior.VERSION_2_4_5:
|
||||||
|
return sorted(self.tw.execute_command(['_projects']))
|
||||||
|
else:
|
||||||
|
return sorted(self.tw.execute_command(['_unique', 'project']))
|
||||||
|
|
||||||
def _complete_any(self, w):
|
def _complete_any(self, w):
|
||||||
if w:
|
if w:
|
||||||
|
|
|
@ -5,6 +5,7 @@ from tests.base import IntegrationTest
|
||||||
|
|
||||||
class FakeTW():
|
class FakeTW():
|
||||||
def __init__(self, projects=[], tags=[]):
|
def __init__(self, projects=[], tags=[]):
|
||||||
|
self.version = '2.5.1'
|
||||||
self.projects = projects
|
self.projects = projects
|
||||||
self.tags = tags
|
self.tags = tags
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue