Mercurial > hg > config
changeset 618:5ab1df94cc8d
read TODOs from directory tree (unfinished)
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Mon, 03 Feb 2014 13:29:12 -0800 |
parents | 3da0a7caf07e |
children | fd50f457185c |
files | python/tippytodos.py |
diffstat | 1 files changed, 30 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/tippytodos.py Mon Feb 03 13:29:12 2014 -0800 @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import argparse +import os +import sys +from subprocess import check_output + +def call(command, **kwargs): + kwargs.setdefault('shell', True) + print (command) + return check_output(command, **kwargs) + +def main(args=sys.argv[1:]): + + usage = '%prog [options]' + parser = argparse.ArgumentParser(usage=usage, description=__doc__) + parser.add_argument('--mark', dest='mark', default='#') + parser.add_argument('-d', '--directory', dest='directory', default='.') + parser.add_argument('-p', '--pattern', dest='pattern', default='*.py') + options = parser.parse_args(args) + + command = ['find', options.directory, '-iname', options.pattern, + '|', + 'grep', '' ... ] # to finish + + output = check_output(subprocess.list2cmdline(command)) + +if __name__ == '__main__': + main()