From 8f8e988ac21fd83860846c0d824cc0efd50b84d8 Mon Sep 17 00:00:00 2001 From: Francesco Luzzana Date: Wed, 6 Apr 2022 17:23:05 +0200 Subject: [PATCH] moving print outside of the file scope in text preview --- screenless/bureau/soup/soup.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/screenless/bureau/soup/soup.py b/screenless/bureau/soup/soup.py index 51510f8..92eb033 100644 --- a/screenless/bureau/soup/soup.py +++ b/screenless/bureau/soup/soup.py @@ -59,11 +59,12 @@ class Soup(Bureau): @add_command('tp', 'Print a short excerpt of a text') def print_preview(self, data): - self.print_small('hello') - # filename, _ = data.split(".") - # with open(os.path.join(self.mdir, 'contents', filename + '.txt'), 'r') as f: - # text = f.read() - # self.print_small(filename + '\n' + text[:200] + '...') + filename, _ = data.split(".") + + with open(os.path.join(self.mdir, 'contents', filename + '.txt'), 'r') as f: + text = f.read() + + self.print_small(filename + '\n' + text[:200] + '...') def main():