summaryrefslogtreecommitdiff
path: root/summain
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-03-20 11:31:18 +0000
committerLars Wirzenius <liw@liw.fi>2011-03-20 11:31:18 +0000
commit19dff876e38b35d825a286b1f8a7c368ac42e024 (patch)
tree5bc91e8e8b230e7775c9709132a7c558b8721b39 /summain
parentb74b5d783c718111cf9b346e0218a75735f4a791 (diff)
parent48be02c4ab76f591dbf627be067abc9137c17d69 (diff)
downloadsummain-19dff876e38b35d825a286b1f8a7c368ac42e024.tar.gz
Add --mangle-paths option.
Diffstat (limited to 'summain')
-rwxr-xr-xsummain10
1 files changed, 8 insertions, 2 deletions
diff --git a/summain b/summain
index 8759fd4..de62c4b 100755
--- a/summain
+++ b/summain
@@ -27,6 +27,8 @@ class Summain(cliapp.Application):
def add_settings(self):
self.settings.add_boolean_setting(['relative-paths', 'r'],
'print paths relative to arguments')
+ self.settings.add_boolean_setting(['mangle-paths', 'm'],
+ 'mangle (obfuscate) paths')
def files(self, root):
if os.path.isdir(root):
@@ -39,10 +41,14 @@ class Summain(cliapp.Application):
def process_args(self, args):
relative = self.settings['relative-paths']
- normalizer = summainlib.NumberNormalizer()
+ nn = summainlib.NumberNormalizer()
+ if self.settings['mangle-paths']:
+ pn = summainlib.PathNormalizer()
+ else:
+ pn = summainlib.SamePath()
for root in args:
for filename in self.files(root):
- o = summainlib.FilesystemObject(filename, normalizer)
+ o = summainlib.FilesystemObject(filename, nn, pn)
self.output.write(o.format(root if relative else None))
self.output.write('\n')