added -f option to force usage of an unsupported version of taskwarrior
authorJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 24 Jun 2015 20:20:11 +0000 (22:20 +0200)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 24 Jun 2015 20:20:11 +0000 (22:20 +0200)
NEWS
NEWS.html
po/Makefile
po/Makefile.in
po/fr.gmo
po/fr.po
po/ptask.pot
src/main.c
src/tw.c
src/tw.h

diff --git a/NEWS b/NEWS
index f205486..42dd54a 100644 (file)
--- 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
 ------
index feae775..b169456 100644 (file)
--- a/NEWS.html
+++ b/NEWS.html
@@ -320,6 +320,29 @@ asciidoc.install();
 </div>\r
 <div id="content">\r
 <div class="sect1">\r
+<h2 id="_v1_0_0">v1.0.0</h2>\r
+<div class="sectionbody">\r
+<div class="ulist"><ul>\r
+<li>\r
+<p>\r
+allowed 2.4.0 and 2.4.1 release of taskwarrior.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+added keywords in the desktop file.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+added a command line option to force usage of an unsupported\r
+   version of taskwarrior (risk of malfunction like damaging data).\r
+</p>\r
+</li>\r
+</ul></div>\r
+</div>\r
+</div>\r
+<div class="sect1">\r
 <h2 id="_v0_0_9">v0.0.9</h2>\r
 <div class="sectionbody">\r
 <div class="ulist"><ul>\r
@@ -623,7 +646,7 @@ Initial release.
 <div id="footer">\r
 <div id="footer-text">\r
 Last updated\r
- 2014-11-22 11:33:59 CET\r
+ 2015-06-24 22:14:21 CEST\r
 </div>\r
 </div>\r
 </body>\r
index 9345d18..36bccb2 100644 (file)
@@ -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)
 
index 6272b9a..e22c490 100644 (file)
@@ -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)
 
index be77974..ae7d865 100644 (file)
Binary files a/po/fr.gmo and b/po/fr.gmo differ
index 2eba39c..06c5070 100644 (file)
--- 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 <Unknown>\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 ""
index edc09f9..cda6ff7 100644 (file)
@@ -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 <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\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 ""
index 8dc69ba..0f66224 100644 (file)
@@ -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;
index cd48857..2a81754 100644 (file)
--- a/src/tw.c
+++ b/src/tw.c
@@ -31,6 +31,9 @@
 #include <pstr.h>
 #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;
+}
index 684c56f..66f3c57 100644 (file)
--- 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