diff options
author | Lars Wirzenius <liw@liw.fi> | 2011-06-11 19:54:15 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2011-06-11 19:54:15 +0100 |
commit | 8d2493c09465f933bf72922b118078813cae8d37 (patch) | |
tree | 5795e93172c3bfa49cc350d397a3a5ac6adcb21a /summain | |
parent | 6dee09fe1b6bf92ae8bd190edc014df84fea19cb (diff) | |
download | summain-8d2493c09465f933bf72922b118078813cae8d37.tar.gz |
Add --checksum option to allow choosing checksums to compute.
Only SHA1 is computed by default.
Diffstat (limited to 'summain')
-rwxr-xr-x | summain | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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') |