use rc.confirmation=no for tw 2.2.0
authorJean-Philippe Orsini <jeanfi@gmail.com>
Sat, 19 Oct 2013 13:49:17 +0000 (13:49 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Sat, 19 Oct 2013 13:49:17 +0000 (13:49 +0000)
NEWS
NEWS.html
config.status
po/Makefile
po/Makefile.in
src/main.c
src/tw.c

diff --git a/NEWS b/NEWS
index 721bcab..565f9b3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,9 +9,9 @@ v0.0.4
  * added manpage.
  * popup error dialog when .taskrc does not exist.
  * added --debug.
- * supported version of taskwarrior is 2.2.0.
+ * supported versions of taskwarrior are 2.2.0 and 2.0.0.
  * added taskwarrior version checking.
- * added .taskrc check (must exist).
+ * added support for taskwarrior 2.2.0 (avoid confirmation query).
 
 v0.0.3
 ------
index 901d329..1e42666 100644 (file)
--- a/NEWS.html
+++ b/NEWS.html
@@ -775,7 +775,7 @@ added --debug.
 </li>\r
 <li>\r
 <p>\r
-supported version of taskwarrior is 2.2.0.\r
+supported versions of taskwarrior are 2.2.0 and 2.0.0.\r
 </p>\r
 </li>\r
 <li>\r
@@ -785,7 +785,7 @@ added taskwarrior version checking.
 </li>\r
 <li>\r
 <p>\r
-added .taskrc check (must exist).\r
+added support for taskwarrior 2.2.0 (avoid confirmation query).\r
 </p>\r
 </li>\r
 </ul></div>\r
@@ -856,7 +856,7 @@ Initial release.
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Last updated 2013-10-19 12:04:17 CEST\r
+Last updated 2013-10-19 15:48:52 CEST\r
 </div>\r
 </div>\r
 </body>\r
index 3819bc5..7a9ef8b 100755 (executable)
@@ -428,7 +428,7 @@ $config_commands
 Report bugs to <jeanfi@gmail.com>.
 ptask home page: <http://wpitchoune.net/ptask>."
 
-ac_cs_config=""
+ac_cs_config="'--prefix=/tmp'"
 ac_cs_version="\
 ptask config.status 0.0.x
 configured by ./configure, generated by GNU Autoconf 2.69,
@@ -520,7 +520,7 @@ if $ac_cs_silent; then
 fi
 
 if $ac_cs_recheck; then
-  set X /bin/bash './configure'  $ac_configure_extra_args --no-create --no-recursion
+  set X /bin/bash './configure'  '--prefix=/tmp' $ac_configure_extra_args --no-create --no-recursion
   shift
   $as_echo "running CONFIG_SHELL=/bin/bash $*" >&6
   CONFIG_SHELL='/bin/bash'
@@ -746,7 +746,7 @@ S["libexecdir"]="${exec_prefix}/libexec"
 S["sbindir"]="${exec_prefix}/sbin"
 S["bindir"]="${exec_prefix}/bin"
 S["program_transform_name"]="s,x,x,"
-S["prefix"]="/usr/local"
+S["prefix"]="/tmp"
 S["exec_prefix"]="${prefix}"
 S["PACKAGE_URL"]="http://wpitchoune.net/ptask"
 S["PACKAGE_BUGREPORT"]="jeanfi@gmail.com"
index 430bf0b..ea8150b 100644 (file)
@@ -21,7 +21,7 @@ srcdir = .
 top_srcdir = ..
 
 
-prefix = /usr/local
+prefix = /tmp
 exec_prefix = ${prefix}
 datarootdir = ${prefix}/share
 datadir = ${datarootdir}
index 9db3564..ca508b4 100644 (file)
@@ -21,7 +21,7 @@ srcdir = .
 top_srcdir = ..
 
 
-prefix = /usr/local
+prefix = /tmp
 exec_prefix = ${prefix}
 datarootdir = ${prefix}/share
 datadir = ${datarootdir}
index 6a98b1c..36c0d19 100644 (file)
@@ -209,10 +209,7 @@ static void refresh()
                                                GTK_BUTTONS_CLOSE,
                                                _("Error loading tasks, verify "
                                                  "that a supported version of "
-                                                 "taskwarrior is installed "
-                                                 "and its configuration file "
-                                                 "exist."
-                                                 ));
+                                                 "taskwarrior is installed "));
                gtk_dialog_run(GTK_DIALOG(dialog));
                gtk_widget_destroy(dialog);
        }
index 2b82693..30f5dcb 100644 (file)
--- a/src/tw.c
+++ b/src/tw.c
 #include <pstr.h>
 #include "tw.h"
 
-
-static int has_taskrc()
-{
-       char *home, *path;
-       int ret;
-       struct stat st;
-
-       home = getenv("HOME");
-
-       if (!home) {
-               log_err("HOME environment variable not defined");
-               return 0;
-       }
-
-       path = malloc(strlen(home) + 1 + strlen(".taskrc") + 1);
-       sprintf(path, "%s/%s", home, ".taskrc");
-
-       ret = lstat(path, &st);
-
-       free(path);
-
-       return ret == 0;
-}
-
 static char *task_exec(char *opts)
 {
        FILE *f;
@@ -115,7 +91,7 @@ static int task_check_version()
 
        log_debug("task version: %s", ver);
 
-       if (!strcmp(ver, "2.2.0"))
+       if (!strcmp(ver, "2.2.0") || !strcmp(ver, "2.0.0"))
                return 1;
        else
                return 0;
@@ -123,8 +99,7 @@ static int task_check_version()
 
 static char *tw_exec(char *opts)
 {
-       if (!has_taskrc())
-               return NULL;
+       char *opts2;
 
        if (!task_check_version()) {
                log_err("ptask is not compatible with the installed version of"
@@ -132,7 +107,13 @@ static char *tw_exec(char *opts)
                return NULL;
        }
 
-       return task_exec(opts);
+       opts2 = malloc(strlen("rc.confirmation:no ")
+                      + strlen(opts)
+                      + 1);
+       strcpy(opts2, "rc.confirmation:no ");
+       strcat(opts2, opts);
+
+       return task_exec(opts2);
 }
 
 static struct json_object *task_exec_json(char *opts)