scripts: Adopted -n/--lines in most ascii art scripts

The notable exception being plot.py, where line-level history doesn't
really make sense.

These scripts all default to height=1, and -n/--lines can be useful for
viewing changes over time.

In theory you could achieve something similar to this with tailpipe.py,
but you would lose the header info, which is useful.

---

Note, as a point of simplicity, we do _not_ show sub-char history like
we used to in tracebd.py. That was way too complicated for what it was
worth.
This commit is contained in:
Christopher Haster
2025-04-10 17:12:56 -05:00
parent 8e3760c5b8
commit fc5bfdae14
5 changed files with 113 additions and 29 deletions
+3 -3
View File
@@ -2511,13 +2511,13 @@ def main(path='-', *,
# other scripts?
width=width,
# make space for shell prompt
height=height if height is not False else -1)
height=-1 if height is ... else height)
# not cat? write to a bounded ring
else:
ring_ = RingIO(head=head)
draw__(ring_,
width=width,
height=height if height is not False else 0)
height=0 if height is ... else height)
# no history? draw immediately
if lines is None:
ring_.draw()
@@ -2704,7 +2704,7 @@ if __name__ == "__main__":
'-H', '--height',
nargs='?',
type=lambda x: int(x, 0),
const=False,
const=..., # handles shell prompt spacing, which is a bit subtle
help="Height in rows. <=0 uses the terminal height. Defaults "
"to 1.")
parser.add_argument(