diff options
Diffstat (limited to 'summain')
-rwxr-xr-x | summain | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -32,6 +32,11 @@ 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: ' + 'MD5, SHA1, SHA224, SHA256, SHA384, SHA512; ' + 'use once per checksum type ' + '(default is SHA1)') def files(self, root): if os.path.isdir(root): @@ -50,9 +55,18 @@ class Summain(cliapp.Application): pn = summainlib.PathNormalizer() else: pn = summainlib.SamePath() + checksums = [x.upper() + for x in self.settings['checksum'] or ['SHA1']] + o = summainlib.FilesystemObject('.', nn, pn, exclude, checksums) + for checksum in checksums: + try: + o[checksum] + except KeyError: + raise cliapp.AppException('Unknown checksum %s' % checksum) 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') |