Mercurial > hg > config
annotate python/stripirssi.py @ 396:f3472dd25d9e
already at http://k0s.org/portfolio/python/pypi.html
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 29 Jul 2013 22:44:30 -0700 |
parents | 0f679925616d |
children | 364ddd44fd82 |
rev | line source |
---|---|
371
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
2 |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
3 import optparse |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
4 import os |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
5 import sys |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
6 |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
7 """ |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
8 strip irssi comments |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
9 """ |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
10 |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
11 # XXX stub |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
12 |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
13 here = os.path.dirname(os.path.realpath(__file__)) |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
14 |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
15 def main(args=sys.argv[1:]): |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
16 |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
17 usage = '%prog [options]' |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
18 parser = optparse.OptionParser(usage=usage, description=__doc__) |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
19 parser.add_option('-i', '--in-place', dest='in_place', |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
20 help="rewrite files in place") |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
21 # parser.add_option - strip timestamps only |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
22 # parser.add_option - strip nicks |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
23 options, args = parser.parse_args(args) |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
24 |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
25 if __name__ == '__main__': |
0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
26 main() |