From 101a1e09e7aa5b391de1ea1b804d78769411b2fb Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Tue, 28 Mar 2023 14:45:47 +0200 Subject: [PATCH] show. Align content line, after line number in read_lines() --- src/var/lib/tyto/program/show.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/var/lib/tyto/program/show.py b/src/var/lib/tyto/program/show.py index 6f7a266..3d571a8 100644 --- a/src/var/lib/tyto/program/show.py +++ b/src/var/lib/tyto/program/show.py @@ -145,12 +145,13 @@ def read_lines(f): if not tyto.exists(f): logs.out("1", f, True) datas = open(f).read() + + # Align content line, after line number ln_datas = len(datas.splitlines()) + 1 sp_max = len(str(ln_datas)) - spaces = '%s'%(sp_max * " ") + for ln, line in enumerate(datas.rsplit('\n'), 1): sp = sp_max - len(str(ln)) - print(' ā”‚ %s %sā”‚ %s'%(ln, int(sp) * " ", line)) dom.valid()