diff -Nru yagtd-0.3.3/AUTHORS yagtd-0.3.4/AUTHORS --- yagtd-0.3.3/AUTHORS 2007-09-23 13:15:26.000000000 +0000 +++ yagtd-0.3.4/AUTHORS 2010-07-24 08:15:42.000000000 +0000 @@ -7,5 +7,18 @@ MiKael 'MicKey' NAVARRO Contributors: - Thomas VANDER STICHELE Miguel DARDENNE + Thomas VANDER STICHELE + Daniel SCHÜSSLER + Ward VANDEWEGE + Hu SONGTAO + Aurelien BOMPARD + Max VOZELER + Nicolas MAITRE + Alexander SCHREMMER + Wouter VAN HEYST + Florian KRAUSE + Geobert + Soren HANSEN + Serafeim ZANIKOLA + Miroslaw OPOKA diff -Nru yagtd-0.3.3/ChangeLog yagtd-0.3.4/ChangeLog --- yagtd-0.3.3/ChangeLog 2010-06-30 05:09:25.000000000 +0000 +++ yagtd-0.3.4/ChangeLog 2010-08-18 20:32:18.000000000 +0000 @@ -3,7 +3,17 @@ # A primitive Getting Things Done to-do list manager. # -2010-06-29 Miroslaw Opoka +2010-07-30 Max VOZELER + + * yagtd.sh: Add a small shell function which IMHO gives a + typing-friendlier interface (task#7119). + +2010-07-23 MiKael NAVARRO, Max VOZELER + + * yagtd-cli.py: Add a wrapper (task#7119) to run commands + non-interactively. + +2010-06-29 Miroslaw OPOKA * yagtd.py (_parse_line): Other date input format (D: as "mo", "tu", ..., "su"). @@ -13,7 +23,7 @@ * yagtd.py, yagtd.1: add a --quiet option for not printing the copyright message upon startup (patch#1699). -2010-04-23 Geobert, Soren Hansen, MiKael NAVARRO +2010-04-23 Geobert, Soren HANSEN, MiKael NAVARRO * yagtd.py (do_archive): fix crash (bug #13987) when archive then order. @@ -34,7 +44,7 @@ * yagtd.py (do_list*): disp number of task found after a research. -2010-04-17 Wouter van Heyst +2010-04-17 Wouter VAN HEYST * yagtd.py (do_print): an approach to also printing out not otherwise printed tasks (tasks that do not have contexts, diff -Nru yagtd-0.3.3/debian/changelog yagtd-0.3.4/debian/changelog --- yagtd-0.3.3/debian/changelog 2011-05-01 03:13:22.000000000 +0000 +++ yagtd-0.3.4/debian/changelog 2011-05-01 03:13:22.000000000 +0000 @@ -1,3 +1,10 @@ +yagtd (0.3.4-1) unstable; urgency=low + + * New upstream release + * Update to policy 3.9.1; no changes needed. + + -- Max Vozeler Wed, 23 Feb 2011 18:23:23 +0100 + yagtd (0.3.3-1) unstable; urgency=low * New upstream release. diff -Nru yagtd-0.3.3/debian/control yagtd-0.3.4/debian/control --- yagtd-0.3.3/debian/control 2011-05-01 03:13:22.000000000 +0000 +++ yagtd-0.3.4/debian/control 2011-05-01 03:13:22.000000000 +0000 @@ -3,7 +3,7 @@ Priority: optional Maintainer: Max Vozeler Build-Depends: debhelper (>= 7.0.50~), python (>= 2.3), python-support -Standards-Version: 3.8.4 +Standards-Version: 3.9.1 Homepage: https://gna.org/projects/yagtd/ Package: yagtd diff -Nru yagtd-0.3.3/LISEZMOI yagtd-0.3.4/LISEZMOI --- yagtd-0.3.3/LISEZMOI 2010-04-15 19:38:10.000000000 +0000 +++ yagtd-0.3.4/LISEZMOI 2010-07-24 08:01:46.000000000 +0000 @@ -86,6 +86,9 @@ Pour plus de détails référez-vous à la documentation fournie dans le sous répertoire doc/. +Pour une interface en ligne de commande (non-interactive) un wrapper +``yagtd-cli.py`` est disponible dans le sous-répertoire tools/. + Remarque ======== diff -Nru yagtd-0.3.3/NEWS yagtd-0.3.4/NEWS --- yagtd-0.3.3/NEWS 2010-06-30 05:09:55.000000000 +0000 +++ yagtd-0.3.4/NEWS 2010-08-18 20:33:09.000000000 +0000 @@ -13,8 +13,16 @@ - Display item with empty context or project. - Review IO functions +Changes New in release 0.3.4 - 30 July 2010 +------------------------------------------- + +- Add a wrapper 'yagtd-cli.py' (task#7119) to run commands + non-interactively. +- Add a small shell script 'yagtd.sh' which IMHO gives a + typing-friendlier interface (task#7119). + Changes New in release 0.3.3 - 29 June 2010 --------------------------------------------- +------------------------------------------- - Add other date input format (D: as "mo", "tu", ..., "su"). - Add a --quiet option for not printing the copyright message upon @@ -43,7 +51,7 @@ ----------------------------------------------- - Add some shortcuts (for S60 platform). -- Main program for S60 platform (Nokia Symbian OS) added. +- Main program 'yagtd-s60.py' for S60 platform (Nokia Symbian OS) added. Changes New in release 0.3.0 - 06 November 2009 ----------------------------------------------- diff -Nru yagtd-0.3.3/PKG-INFO yagtd-0.3.4/PKG-INFO --- yagtd-0.3.3/PKG-INFO 2010-06-30 05:11:58.000000000 +0000 +++ yagtd-0.3.4/PKG-INFO 2010-08-18 20:35:11.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: yagtd -Version: 0.3.3 +Version: 0.3.4 Summary: Yet Another Getting Things Done Home-page: https://gna.org/projects/yagtd Author: Mikael NAVARRO diff -Nru yagtd-0.3.3/README yagtd-0.3.4/README --- yagtd-0.3.3/README 2010-04-16 20:33:03.000000000 +0000 +++ yagtd-0.3.4/README 2010-07-24 08:01:52.000000000 +0000 @@ -82,12 +82,15 @@ then, see documentation for more details. +For (non-interactively) CLI a wrapper ``yagtd-cli.py`` is available +under tools directory. + Remark ====== -An Emacs major mode for viewing yaGTD to-do list is available under -tools directory; -And, a wrapper for pyS60 (Symbian) smartphone. +An Emacs major mode for viewing yaGTD to-do list, and a wrapper +``yagtd-s60.py`` for pyS60 (Symbian) smartphone are available under +tools directory. -- MiKael NAVARRO diff -Nru yagtd-0.3.3/setup.py yagtd-0.3.4/setup.py --- yagtd-0.3.3/setup.py 2010-06-10 20:15:58.000000000 +0000 +++ yagtd-0.3.4/setup.py 2010-08-18 20:28:48.000000000 +0000 @@ -14,7 +14,7 @@ # Setup. # setup(name='yagtd', - version='0.3.3', + version='0.3.4', description='Yet Another Getting Things Done', author='Mikael NAVARRO', author_email='klnavarro@free.fr', @@ -34,7 +34,9 @@ 'doc/yagtd.html', 'doc/default.css']), ('share/man/man1', ['doc/yagtd.1']), ('share/doc/yagtd/tools', ['tools/yagtd-mode.el', - 'tools/yagtd-s60.py'])], + 'tools/yagtd-s60.py', + 'tools/yagtd-cli.py', + 'tools/yagtd.sh'])], scripts=['src/yagtd.py'], classifiers = ['Development Status :: 4 - Beta', 'Intended Audience :: End Users/Desktop', diff -Nru yagtd-0.3.3/src/yagtd.py yagtd-0.3.4/src/yagtd.py --- yagtd-0.3.3/src/yagtd.py 2010-06-29 23:13:05.000000000 +0000 +++ yagtd-0.3.4/src/yagtd.py 2010-07-24 08:11:40.000000000 +0000 @@ -29,8 +29,8 @@ # Specific variables for pydoc __author__ = "MiKael Navarro " -__date__ = "June 2010" -__version__ = "0.3.3" +__date__ = "July 2010" +__version__ = "0.3.4" # Include directives import os @@ -508,7 +508,7 @@ def do_add(self, line): """Add a new task (from the input line): - GTD> add Ny new task. @context p:Project""" + GTD> add My new task. @context p:Project""" task_id = self._add(line) if task_id: @@ -736,7 +736,7 @@ # def do_urgency(self, id_level): - """Set the Urgency (5=today,4=this_week,3=this_month,2=this_quarter,1=this_year): + """Set the Urgency (5=today, 4=this_week, 3=this_month, 2=this_quarter, 1=this_year): GTD> urgency #id lvl""" # Parse command line diff -Nru yagtd-0.3.3/tools/yagtd-cli.py yagtd-0.3.4/tools/yagtd-cli.py --- yagtd-0.3.3/tools/yagtd-cli.py 1970-01-01 00:00:00.000000000 +0000 +++ yagtd-0.3.4/tools/yagtd-cli.py 2010-07-24 08:32:52.000000000 +0000 @@ -0,0 +1,181 @@ +#! /usr/bin/python -O +# -*- coding: utf-8 -*- +# +# To-do list manager. +# Copyright (C) 2006-2010 MiKael NAVARRO +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +"""yaGTD +Copyright (C) 2006-2010 MiKael NAVARRO + +A primitive Getting Things Done to-do list manager. +CLI version: allowing to run commands non-interactively. + +""" + +# Specific variables for pydoc +__author__ = "MiKael Navarro " +__date__ = "July 2010" + +# Include directives +import os +import sys +sys.path.append(os.path.join(sys.path[0], '../src')) # add src dir +import inspect # function inspect +import yagtd + +# +# Subclass optparse.IndentedHelpFormatter in order +# to display correctly (with new lines) the help. +# +# TODO: use 'argparse' (new in Python version 2.7). +# +from optparse import IndentedHelpFormatter +import textwrap + +class IndentedHelpFormatterWithNL(IndentedHelpFormatter): + """IndentedHelpFormatter Subclass + in order to display correctly (with new lines) the help. + + By Tim CHASE.""" + + def format_description(self, description): + """Return formatted program description.""" + + if not description: return "" + + desc_width = self.width - self.current_indent + indent = " "*self.current_indent + + # The above is still the same + bits = [ line.strip() for line in description.split('\n') ] + formatted_bits = [ + textwrap.fill(bit, + desc_width, + initial_indent=indent, + subsequent_indent=indent) + for bit in bits ] + + return "\n".join(formatted_bits) + "\n" + + format_epilog = format_description + + def format_option(self, option): + """Return formatted option description. + + The help for each option consists of two parts: + * the opt strings and metavars + eg. ("-x", or "-fFILENAME, --file=FILENAME") + * the user-supplied help string + eg. ("turn on expert mode", "read data from FILENAME") + + If possible, we write both of these on the same line: + -x turn on expert mode + + But if the opt string list is too long, we put the help + string on a second line, indented to the same column it would + start in if it fit on the first line. + -fFILENAME, --file=FILENAME + read data from FILENAME + """ + + result = [] + opts = self.option_strings[option] + opt_width = self.help_position - self.current_indent - 2 + + if len(opts) > opt_width: + opts = "%*s%s\n" % (self.current_indent, "", opts) + indent_first = self.help_position + else: # start help on same line as opts + opts = "%*s%-*s " % (self.current_indent, "", opt_width, opts) + indent_first = 0 + result.append(opts) + + if option.help: + help_text = self.expand_default(option) + # Everything is the same up through here + help_lines = [] + for para in [ line.strip().lower() for line in help_text.split("\n") ]: + help_lines.extend(textwrap.wrap(para, self.help_width)) + # Everything is the same after here + result.append("%*s%s\n" % (indent_first, "", help_lines[0])) + result.extend(["%*s%s\n" % (self.help_position, "", line) + for line in help_lines[1:]]) + elif opts[-1] != "\n": + result.append("\n") + + return "".join(result) + +# +# External entry point. +# +if __name__ == "__main__": + # First instanciate yaGTD object + gtd_cli = yagtd.GTD() + gtd_cli.intro = "" + + available_cmds = [ attr.replace("do_", "") for attr in dir(gtd_cli) + if attr.startswith('do_') and len(attr) > 4 and attr != 'do_help' ] + #print available_cmds + + # Get options + from optparse import OptionParser + + parser = OptionParser(usage="""python -O %prog [--cmd \"args\"] [--help] todo.txt""", + description="""A primitive Getting Things Done to-do list manager. + CLI version: allowing to run commands non-interactively.""", + epilog=""" + Ex.: + %prog --list \"5\" todo.txt + %prog --add \"Text @work p:customer\" --list \"\" todo.txt + %prog --status \"\" todo.txt + """.replace("%prog", sys.argv[0]), + formatter=IndentedHelpFormatterWithNL(), + conflict_handler="resolve") + + # Loop on all available yaGTD commands + # and add an option... + for cmd in available_cmds: + func_name = "do_"+cmd + func = getattr(gtd_cli, func_name) # function pointer + func_arg = "_".join(inspect.getargspec(func).args[1:]) + parser.add_option("", "--"+cmd, + action="store", dest=cmd, + default=None, + help=func.__doc__) + + (options, args) = parser.parse_args() + + # Needed argument + if not args: + parser.error("missing todo file argument") + elif len(args) != 1: + parser.error("incorrect number of arguments") + + # Process start here + gtd_cli.do_load(args[0]) + + # Determine which command are called? + for cmd in available_cmds: + cmd_opt = getattr(options, cmd) + if cmd_opt != None: + func = getattr(gtd_cli, "do_"+cmd) + func(cmd_opt) # execute + + # Automatically save at the end + func = getattr(gtd_cli, "do_save") + func("") diff -Nru yagtd-0.3.3/tools/yagtd.sh yagtd-0.3.4/tools/yagtd.sh --- yagtd-0.3.3/tools/yagtd.sh 1970-01-01 00:00:00.000000000 +0000 +++ yagtd-0.3.4/tools/yagtd.sh 2010-08-18 20:25:35.000000000 +0000 @@ -0,0 +1,115 @@ +#! /bin/sh +# +# To-do list manager. +# Copyright (C) 2010 Max VOZELER +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +# Default path to your 'todo.txt' file. +TODOFILE=~/todo.txt +#TODOFILE=../tests/todo.txt + +# Path to 'yagtd-cli.py' wrapper. +YAGTD_CLI=yagtd-cli.py +#YAGTD_CLI=./yagtd-cli.py + +# +# Function given to trap built in command. +# +trapsignal() { + echo "\nSignal received. Doing cleanup before ending...." + exit 1; +} + +# +# Print script usage. +# +usage() { + echo "Usage: `basename $1` " + echo "" + echo "Provide way to run commands non-interactively." + echo "" + echo " -v verbose mode" + echo " -d debug mode" + echo " -h this help" + echo "" + echo "Ex:" + echo " `basename $1` add Text @work p:customer2" + echo " `basename $1` listall" + echo " `basename $1` search @home" + echo "" + echo "Return values :" + echo " 0 => OK" + echo " 1 => KO" + echo " 2 => error in arguments" +} + +# Trapping signals INT TERM +trap trapsignal INT TERM + +# +# Option parsing. +# +ARGERROR=0 + +# Script with no option => print usage and exit +if [ $# -eq 0 ] +then + usage ${0} + exit 2 +fi + +while getopts :dvh opt + do + case ${opt} in + h) usage ${0};exit 0;; + d) set -x;; + v) set -v;; + \?) echo "Unknown option: ${OPTARG}";ARGERROR=1;; + esac +done +shift `expr $OPTIND - 1` + +if [ ${ARGERROR} != 0 ] +then + echo "Error(s) in option parsing. Aborting!" + exit 2 +fi + +# Get + +if [ $# -gt 0 ] +then + CMD=$1 + shift + ARGS=$* +else + echo "Error: missing arguments" + exit 2 +fi + +# +# Main +# +while true +do + # Call yaGTD CLI + echo "$YAGTD_CLI --$CMD \"$ARGS\" $TODOFILE" + $YAGTD_CLI --$CMD "$ARGS" $TODOFILE + if [ $? != 0 ]; then exit 1; fi + break +done + +exit 0