summaryrefslogtreecommitdiff
path: root/summain
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-06-11 19:54:15 +0100
committerLars Wirzenius <liw@liw.fi>2011-06-11 19:54:15 +0100
commit8d2493c09465f933bf72922b118078813cae8d37 (patch)
tree5795e93172c3bfa49cc350d397a3a5ac6adcb21a /summain
parent6dee09fe1b6bf92ae8bd190edc014df84fea19cb (diff)
downloadsummain-8d2493c09465f933bf72922b118078813cae8d37.tar.gz
Add --checksum option to allow choosing checksums to compute.
Only SHA1 is computed by default.
Diffstat (limited to 'summain')
-rwxr-xr-xsummain7
1 files changed, 6 insertions, 1 deletions
diff --git a/summain b/summain
index 2ff1b21..ac9d7c9 100755
--- a/summain
+++ b/summain
@@ -32,6 +32,8 @@ class Summain(cliapp.Application):
self.settings.string_list(['exclude'],
'do not output or compute FIELD',
metavar='FIELD')
+ self.settings.string_list(['checksum', 'c'],
+ 'which checksums to compute')
def files(self, root):
if os.path.isdir(root):
@@ -50,9 +52,12 @@ class Summain(cliapp.Application):
pn = summainlib.PathNormalizer()
else:
pn = summainlib.SamePath()
+ checksums = [x.upper()
+ for x in self.settings['checksum'] or ['SHA1']]
for root in args:
for filename in self.files(root):
- o = summainlib.FilesystemObject(filename, nn, pn, exclude)
+ o = summainlib.FilesystemObject(filename, nn, pn, exclude,
+ checksums)
self.output.write(o.format(root if relative else None))
self.output.write('\n')