From 8d2493c09465f933bf72922b118078813cae8d37 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 11 Jun 2011 19:54:15 +0100 Subject: Add --checksum option to allow choosing checksums to compute. Only SHA1 is computed by default. --- summain | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'summain') 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') -- cgit v1.2.1