Make --funky print what it should. Normalise() is now __call__()

This commit is contained in:
Kjistóf 2017-08-23 23:27:50 +02:00 committed by Kristóf Tóth
parent 57d0ab4650
commit 24cd974129
1 changed files with 4 additions and 4 deletions

View File

@ -32,7 +32,7 @@ class normalisename:
self._separator = separator
self._whitelist = set(whitelist)
def normalise(self, files):
def __call__(self, files):
for path in files:
if not self.check_normal(path):
dir = dirname(path)
@ -85,11 +85,11 @@ if __name__ == '__main__':
# define operations
listchanges = lambda a, b: print('{}{} --> {}'.format(a, ' '*(60-len(a)), b))
listfunky = lambda a, b: print(b)
listfunky = lambda a, b: print(a)
operation = rename
if args.dryrun: operation = listchanges
elif args.funky: operation = listfunky
normalisename(operation, args.separator, whitelist).normalise(args.files)
# do what needs to be done
normalisename(operation, args.separator, whitelist)(args.files)