From 1d479bf18659d6dcb4fefed032088bf4c56d24de Mon Sep 17 00:00:00 2001 From: Jean-Philippe Orsini Date: Wed, 24 Jun 2015 22:20:11 +0200 Subject: [PATCH] added -f option to force usage of an unsupported version of taskwarrior --- NEWS | 2 ++ NEWS.html | 25 ++++++++++++++++++++++++- po/Makefile | 10 +++++----- po/Makefile.in | 10 +++++----- po/fr.gmo | Bin 890 -> 890 bytes po/fr.po | 36 +++++++++++++++++++++++------------- po/ptask.pot | 36 +++++++++++++++++++++++------------- src/main.c | 13 ++++++++++--- src/tw.c | 20 +++++++++++++++----- src/tw.h | 3 +++ 10 files changed, 110 insertions(+), 45 deletions(-) diff --git a/NEWS b/NEWS index f205486..42dd54a 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ v1.0.0 ------ * allowed 2.4.0 and 2.4.1 release of taskwarrior. * added keywords in the desktop file. + * added a command line option to force usage of an unsupported + version of taskwarrior (risk of malfunction like damaging data). v0.0.9 ------ diff --git a/NEWS.html b/NEWS.html index feae775..b169456 100644 --- a/NEWS.html +++ b/NEWS.html @@ -320,6 +320,29 @@ asciidoc.install();
+

v1.0.0

+
+
    +
  • +

    +allowed 2.4.0 and 2.4.1 release of taskwarrior. +

    +
  • +
  • +

    +added keywords in the desktop file. +

    +
  • +
  • +

    +added a command line option to force usage of an unsupported + version of taskwarrior (risk of malfunction like damaging data). +

    +
  • +
+
+
+

v0.0.9

    @@ -623,7 +646,7 @@ Initial release. diff --git a/po/Makefile b/po/Makefile index 9345d18..36bccb2 100644 --- a/po/Makefile +++ b/po/Makefile @@ -11,7 +11,7 @@ # Origin: gettext-0.16 PACKAGE = ptask -VERSION = 0.0.9 +VERSION = 1.0.0 PACKAGE_BUGREPORT = jeanfi@gmail.com SHELL = /bin/sh @@ -21,7 +21,7 @@ srcdir = . top_srcdir = .. -prefix = /usr/local +prefix = /tmp exec_prefix = ${prefix} datarootdir = ${prefix}/share datadir = ${datarootdir} @@ -34,12 +34,12 @@ INSTALL_DATA = ${INSTALL} -m 644 # We use $(mkdir_p). # In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as # "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions, -# ${SHELL} /home/jporsini/work.local/ptask/install-sh does not start with $(SHELL), so we add it. +# ${SHELL} /home/jporsini/work/ptask/install-sh does not start with $(SHELL), so we add it. # In automake >= 1.10, $(MKDIR_P) is derived from ${MKDIR_P}, which is defined # either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake # versions, $(mkinstalldirs) and $(install_sh) are unused. -mkinstalldirs = $(SHELL) ${SHELL} /home/jporsini/work.local/ptask/install-sh -d -install_sh = $(SHELL) ${SHELL} /home/jporsini/work.local/ptask/install-sh +mkinstalldirs = $(SHELL) ${SHELL} /home/jporsini/work/ptask/install-sh -d +install_sh = $(SHELL) ${SHELL} /home/jporsini/work/ptask/install-sh MKDIR_P = /bin/mkdir -p mkdir_p = $(MKDIR_P) diff --git a/po/Makefile.in b/po/Makefile.in index 6272b9a..e22c490 100644 --- a/po/Makefile.in +++ b/po/Makefile.in @@ -11,7 +11,7 @@ # Origin: gettext-0.16 PACKAGE = ptask -VERSION = 0.0.9 +VERSION = 1.0.0 PACKAGE_BUGREPORT = jeanfi@gmail.com SHELL = /bin/sh @@ -21,7 +21,7 @@ srcdir = . top_srcdir = .. -prefix = /usr/local +prefix = /tmp exec_prefix = ${prefix} datarootdir = ${prefix}/share datadir = ${datarootdir} @@ -34,12 +34,12 @@ INSTALL_DATA = ${INSTALL} -m 644 # We use $(mkdir_p). # In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as # "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions, -# ${SHELL} /home/jporsini/work.local/ptask/install-sh does not start with $(SHELL), so we add it. +# ${SHELL} /home/jporsini/work/ptask/install-sh does not start with $(SHELL), so we add it. # In automake >= 1.10, $(MKDIR_P) is derived from ${MKDIR_P}, which is defined # either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake # versions, $(mkinstalldirs) and $(install_sh) are unused. -mkinstalldirs = $(SHELL) ${SHELL} /home/jporsini/work.local/ptask/install-sh -d -install_sh = $(SHELL) ${SHELL} /home/jporsini/work.local/ptask/install-sh +mkinstalldirs = $(SHELL) ${SHELL} /home/jporsini/work/ptask/install-sh -d +install_sh = $(SHELL) ${SHELL} /home/jporsini/work/ptask/install-sh MKDIR_P = /bin/mkdir -p mkdir_p = $(MKDIR_P) diff --git a/po/fr.gmo b/po/fr.gmo index be77974103af8177c8098748e88388d101f4561a..ae7d8651224e849b9c8f937c76c8a26d825e6d78 100644 GIT binary patch delta 29 kcmeyx_KR)99Yz6DT>~>+BNGK9BP&A-Z3CmtZy5U+0g&Ga+yDRo delta 29 kcmeyx_KR)99Yz5YT|+}%BO?VvBP%0wZ3Dy2Zy5U+0gzJ&(*OVf diff --git a/po/fr.po b/po/fr.po index 2eba39c..06c5070 100644 --- a/po/fr.po +++ b/po/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ptask\n" "Report-Msgid-Bugs-To: jeanfi@gmail.com\n" -"POT-Creation-Date: 2014-11-22 12:27+0100\n" +"POT-Creation-Date: 2015-06-24 22:18+0200\n" "PO-Revision-Date: 2012-05-13 18:15+0000\n" "Last-Translator: jeanfi \n" "Language-Team: French <>\n" @@ -19,7 +19,7 @@ msgstr "" "X-Launchpad-Export-Date: 2012-07-02 08:28+0000\n" "X-Generator: Launchpad (build 15520)\n" -#: src/main.c:55 +#: src/main.c:56 #, c-format msgid "" "Copyright (C) %s jeanfi@gmail.com\n" @@ -29,56 +29,66 @@ msgid "" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" -#: src/main.c:66 +#: src/main.c:67 #, c-format msgid "Usage: %s [OPTION]...\n" msgstr "" -#: src/main.c:68 +#: src/main.c:69 msgid "ptask is a task management user interface based on taskwarrior." msgstr "" -#: src/main.c:72 +#: src/main.c:73 #, fuzzy msgid "Options:" msgstr "Description:" -#: src/main.c:73 +#: src/main.c:74 msgid "" " -h, --help display this help and exit\n" " -v, --version display version information and exit" msgstr "" #: src/main.c:78 +msgid "" +" -f, --force-unsupported-taskwarrior force usage of an unsupported version " +"of taskwarrior" +msgstr "" + +#: src/main.c:80 msgid " -d, --debug=LEVEL set the debug level, integer between 0 and 3" msgstr "" -#: src/main.c:83 +#: src/main.c:85 #, c-format msgid "Report bugs to: %s\n" msgstr "" -#: src/main.c:85 +#: src/main.c:87 #, c-format msgid "%s home page: <%s>\n" msgstr "" -#: src/main.c:120 +#: src/main.c:122 msgid "" "Error loading tasks, verify that a supported version of taskwarrior is " -"installed " +"installed." msgstr "" -#: src/main.c:185 +#: src/main.c:187 msgid "Enables debug mode." msgstr "" -#: src/main.c:194 +#: src/main.c:190 +msgid "Force usage of an unsupported version of taskwarrior." +msgstr "" + +#: src/main.c:201 #, c-format msgid "Try `%s --help' for more information.\n" msgstr "" -#: src/main.c:213 +#: src/main.c:220 #, c-format msgid "Failed to load UI: %s" msgstr "" diff --git a/po/ptask.pot b/po/ptask.pot index edc09f9..cda6ff7 100644 --- a/po/ptask.pot +++ b/po/ptask.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: jeanfi@gmail.com\n" -"POT-Creation-Date: 2014-11-22 12:27+0100\n" +"POT-Creation-Date: 2015-06-24 22:18+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: src/main.c:55 +#: src/main.c:56 #, c-format msgid "" "Copyright (C) %s jeanfi@gmail.com\n" @@ -27,55 +27,65 @@ msgid "" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" -#: src/main.c:66 +#: src/main.c:67 #, c-format msgid "Usage: %s [OPTION]...\n" msgstr "" -#: src/main.c:68 +#: src/main.c:69 msgid "ptask is a task management user interface based on taskwarrior." msgstr "" -#: src/main.c:72 +#: src/main.c:73 msgid "Options:" msgstr "" -#: src/main.c:73 +#: src/main.c:74 msgid "" " -h, --help display this help and exit\n" " -v, --version display version information and exit" msgstr "" #: src/main.c:78 +msgid "" +" -f, --force-unsupported-taskwarrior force usage of an unsupported version " +"of taskwarrior" +msgstr "" + +#: src/main.c:80 msgid " -d, --debug=LEVEL set the debug level, integer between 0 and 3" msgstr "" -#: src/main.c:83 +#: src/main.c:85 #, c-format msgid "Report bugs to: %s\n" msgstr "" -#: src/main.c:85 +#: src/main.c:87 #, c-format msgid "%s home page: <%s>\n" msgstr "" -#: src/main.c:120 +#: src/main.c:122 msgid "" "Error loading tasks, verify that a supported version of taskwarrior is " -"installed " +"installed." msgstr "" -#: src/main.c:185 +#: src/main.c:187 msgid "Enables debug mode." msgstr "" -#: src/main.c:194 +#: src/main.c:190 +msgid "Force usage of an unsupported version of taskwarrior." +msgstr "" + +#: src/main.c:201 #, c-format msgid "Try `%s --help' for more information.\n" msgstr "" -#: src/main.c:213 +#: src/main.c:220 #, c-format msgid "Failed to load UI: %s" msgstr "" diff --git a/src/main.c b/src/main.c index 8dc69ba..0f66224 100644 --- a/src/main.c +++ b/src/main.c @@ -45,6 +45,7 @@ static struct task **tasks; static struct option long_options[] = { {"version", no_argument, 0, 'v'}, {"help", no_argument, 0, 'h'}, + {"force-unsupported-taskwarrior", no_argument, 0, 'f'}, {"debug", required_argument, 0, 'd'}, {0, 0, 0, 0} }; @@ -74,7 +75,8 @@ static void print_help() " -v, --version display version information and exit")); puts(""); - + puts(_(" -f, --force-unsupported-taskwarrior force usage of an" + " unsupported version of taskwarrior")); puts(_(" -d, --debug=LEVEL " "set the debug level, integer between 0 and 3")); @@ -119,7 +121,7 @@ void refresh() GTK_BUTTONS_CLOSE, _("Error loading tasks, verify " "that a supported version of " - "taskwarrior is installed ")); + "taskwarrior is installed.")); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } @@ -171,7 +173,7 @@ int main(int argc, char **argv) #endif cmdok = 1; - while ((optc = getopt_long(argc, argv, "vhd:", long_options, + while ((optc = getopt_long(argc, argv, "vhfd:", long_options, &opti)) != -1) { switch (optc) { case 'h': @@ -184,6 +186,11 @@ int main(int argc, char **argv) log_level = atoi(optarg); log_info(_("Enables debug mode.")); break; + case 'f': + log_info(_("Force usage of an unsupported version of " + "taskwarrior.")); + tw_enable_check_version(0); + break; default: cmdok = 0; break; 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; +} diff --git a/src/tw.h b/src/tw.h index 684c56f..66f3c57 100644 --- a/src/tw.h +++ b/src/tw.h @@ -54,4 +54,7 @@ void tw_task_list_free(struct task **tasks); struct project **tw_get_projects(struct task **tasks); void tw_project_list_free(struct project **); +/* Whether ptask check that the taskwarrior version is supported. */ +void tw_enable_check_version(int e); + #endif -- 2.7.4