def done(arg): lists_dir = tasks.get_dir() for filename in arg.files: _from, _to = lists_dir + filename + ".todo", lists_dir + filename + ".done" print "moving {} to {}".format(_from, _to) os.rename(_from, _to)
def edit(arg): if args.filenames: os.system("gedit "+" ".join([tasks.get_dir()+fn + ".todo" for fn in args.filenames])) else: os.system("todo")
# -*- coding:utf-8 -*- # PYTHON_ARGCOMPLETE_OK import tasks import sys import settings import argparse import random from settings import * from datetime import datetime import platform import os import errno WINDOWS = platform.system() == "Windows" lists_dir = tasks.get_dir() def mkdir_p(path): try: os.makedirs(path) except OSError as exc: # Python >2.5 if exc.errno == errno.EEXIST and os.path.isdir(path): pass else: raise mkdir_p(lists_dir) taskpool = tasks.load_all()