X-Git-Url: http://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Ftw.c;h=89343a45ea8c67504dc1930f9b7059682f3993de;hb=db9c7f7e2a7bebd83de857029942ddb5497140ec;hp=b9f3550fa4bc73b4acad9f2b363d38ad37aabe5a;hpb=e8d7eda5e61b891d7efaff09d94c96f9e40abd28;p=ptask.git diff --git a/src/tw.c b/src/tw.c index b9f3550..89343a4 100644 --- a/src/tw.c +++ b/src/tw.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2013 jeanfi@gmail.com + * Copyright (C) 2012-2016 jeanfi@gmail.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -31,6 +31,9 @@ #include #include "tw.h" +/* Whether ptask check that the taskwarrior version is supported. */ +static int check_version_enabled = 1; + struct tm *parse_time(const char *t) { struct tm *tm; @@ -111,7 +114,9 @@ static int task_check_version() if (!strcmp(ver, "2.2.0") || !strcmp(ver, "2.0.0") || !strcmp(ver, "2.3.0") - || !strcmp(ver, "2.4.0")) + || !strcmp(ver, "2.4.0") + || !strcmp(ver, "2.4.1") + || !strcmp(ver, "2.5.0")) return 1; else return 0; @@ -121,9 +126,11 @@ static char *tw_exec(char *opts) { char *opts2; - if (!task_check_version()) { - log_err("ptask is not compatible with the installed version of" - " taskwarrior."); + if (check_version_enabled && !task_check_version()) { + log_err("ptask is not compatible with the installed version of " + "taskwarrior. The command line option -f can force " + "the usage of an unsupported version of taskwarrior " + "(risk of malfunction like damaging data)."); return NULL; } @@ -156,9 +163,6 @@ static struct json_object *task_exec_json(const char *opts) free(cmd); - if (o && is_error(o)) - return NULL; - return o; } @@ -647,3 +651,8 @@ struct project **tw_get_projects(struct task **tasks) return prjs; } + +void tw_enable_check_version(int e) +{ + check_version_enabled = e; +}