コード例 #1
0
ファイル: due.py プロジェクト: codemac/todo-py
def due(args):
    toprint = []

    fullp = todo.fullparse_entries(args.todofile)
    
    for n, l, ds, ts, ps, cs in fullp:
        if ds:
            toprint.append((ds[0][2:], l, n))

    # get last line number as line count of file
    lineno_count, w,x,y,z,zz = fullp[-1]
    lineno_count = len(str(lineno_count))
    toprint.sort()
    for d, l, n in toprint:
        print "{:0={ww}} {} {}".format(n, d, l.strip(), ww=lineno_count)
コード例 #2
0
ファイル: list.py プロジェクト: codemac/todo-py
def run_projects(args):
    if args.search:
        raise NotImplementedError
    
    projects = {}
    
    fullp = todo.fullparse_entries(args.todofile)

    for n, l, ds, ts, ps, cs in fullp:
        if ps:
            for p in ps:
                if not p in projects:
                    projects[p] = []
                projects[p].append((n,l,ds,ts,ps,cs))

    no_width = len(str(fullp[-1][0]))
    for k, v in projects.items():
        print "{:_^60}".format(k)
        v.sort(lambda x,y: x[1] < y[1])
        for n, l, ds, ts, ps, cs in v:
            print "{:0={ww}} {}".format(n, l.strip(), ww=no_width)