debug text preview

workspace
km0 3 years ago
parent 820df38416
commit 6d777d7dde

@ -60,10 +60,12 @@ class Soup(Bureau):
@add_command('tp', 'Print a short excerpt of a text') @add_command('tp', 'Print a short excerpt of a text')
def print_preview(self, data): def print_preview(self, data):
self.print_small(data) self.log.debug(f'print_preview data param: {data}')
filename, _ = data.split(".") filename, _ = data.split(".")
self.log.debug(f'filename: {filename}')
with open(os.path.join(self.mdir, 'contents', filename + '.txt'), 'r') as f: with open(os.path.join(self.mdir, 'contents', filename + '.txt'), 'r') as f:
text = f.read() text = f.read()
self.print_small(filename + '\n' + text[:200] + '...') self.print_small(filename + '\n' + text[:200] + '...')

Loading…
Cancel
Save