annotate python/tippytodos.py @ 694:ebca6d85213a

File "/usr/lib/python3/dist-packages/IPython/config/__init__.py", line 16, in <module> from .application import * File "/usr/lib/python3/dist-packages/IPython/config/application.py", line 31, in <module> from IPython.config.configurable import SingletonConfigurable File "/usr/lib/python3/dist-packages/IPython/config/configurable.py", line 33, in <module> from IPython.utils.text import indent, wrap_paragraphs File "/usr/lib/python3/dist-packages/IPython/utils/text.py", line 28, in <module> from IPython.external.path import path File "/usr/lib/python3/dist-packages/IPython/external/path/__init__.py", line 2, in <module> from path import * File "/home/jhammel/python/path.py", line 25 print root(path) ^
author Jeff Hammel <k0scist@gmail.com>
date Wed, 09 Jul 2014 16:26:49 -0700
parents 5ab1df94cc8d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
618
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
1 #!/usr/bin/env python
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
3
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
4 import argparse
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
5 import os
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
6 import sys
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
7 from subprocess import check_output
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
8
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
9 def call(command, **kwargs):
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
10 kwargs.setdefault('shell', True)
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
11 print (command)
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
12 return check_output(command, **kwargs)
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
13
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
14 def main(args=sys.argv[1:]):
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
15
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
16 usage = '%prog [options]'
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
17 parser = argparse.ArgumentParser(usage=usage, description=__doc__)
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
18 parser.add_argument('--mark', dest='mark', default='#')
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
19 parser.add_argument('-d', '--directory', dest='directory', default='.')
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
20 parser.add_argument('-p', '--pattern', dest='pattern', default='*.py')
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
21 options = parser.parse_args(args)
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
22
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
23 command = ['find', options.directory, '-iname', options.pattern,
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
24 '|',
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
25 'grep', '' ... ] # to finish
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
26
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
27 output = check_output(subprocess.list2cmdline(command))
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
28
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
29 if __name__ == '__main__':
5ab1df94cc8d read TODOs from directory tree (unfinished)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
30 main()