X-Git-Url: https://git.wpitchoune.net/gitweb/?p=ptask.git;a=blobdiff_plain;f=src%2Ftw.c;fp=src%2Ftw.c;h=2a81754a074803093617d76dd940db61d5d0c825;hp=cd488574e1aadfc49df3a706b62c26050b3f6d18;hb=1d479bf18659d6dcb4fefed032088bf4c56d24de;hpb=8bc982c7028c113e0a90db16d63789b139facc2b diff --git a/src/tw.c b/src/tw.c index cd48857..2a81754 100644 --- a/src/tw.c +++ b/src/tw.c @@ -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; @@ -113,18 +116,20 @@ static int task_check_version() || !strcmp(ver, "2.3.0") || !strcmp(ver, "2.4.0") || !strcmp(ver, "2.4.1")) - return 1; - else return 0; + else + return 1; } 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; } @@ -648,3 +653,8 @@ struct project **tw_get_projects(struct task **tasks) return prjs; } + +void tw_enable_check_version(int e) +{ + check_version_enabled = e; +}