Commit 01946bb0 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Merge branch 'edit'

Feature is not ready yet, but since it's a part of issue #2 I already went
ahead and pushed the first part.
parents 59ba85de eb6bb6f2
...@@ -74,6 +74,7 @@ from topydo.lib.DeleteCommand import DeleteCommand ...@@ -74,6 +74,7 @@ from topydo.lib.DeleteCommand import DeleteCommand
from topydo.lib.DepCommand import DepCommand from topydo.lib.DepCommand import DepCommand
from topydo.lib.DepriCommand import DepriCommand from topydo.lib.DepriCommand import DepriCommand
from topydo.lib.DoCommand import DoCommand from topydo.lib.DoCommand import DoCommand
from topydo.lib.EditCommand import EditCommand
from topydo.lib.ListCommand import ListCommand from topydo.lib.ListCommand import ListCommand
from topydo.lib.ListContextCommand import ListContextCommand from topydo.lib.ListContextCommand import ListContextCommand
from topydo.lib.ListProjectCommand import ListProjectCommand from topydo.lib.ListProjectCommand import ListProjectCommand
...@@ -173,6 +174,7 @@ class CLIApplication(object): ...@@ -173,6 +174,7 @@ class CLIApplication(object):
'dep': DepCommand, 'dep': DepCommand,
'depri': DepriCommand, 'depri': DepriCommand,
'do': DoCommand, 'do': DoCommand,
'edit': EditCommand,
'ls': ListCommand, 'ls': ListCommand,
'lscon': ListContextCommand, 'lscon': ListContextCommand,
'listcon': ListContextCommand, 'listcon': ListContextCommand,
......
# Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 Bram Schoenmakers <me@bramschoenmakers.nl>
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
import os
from subprocess import call
from topydo.lib.Command import Command
from topydo.lib.Config import config
class EditCommand(Command):
def __init__(self, p_todolist, *p_args):
super(EditCommand, self).__init__([], None)
def execute(self):
editor = os.environ['EDITOR'] or 'vi'
todo = config().todotxt()
return call([editor, todo]) == 0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment