scripts: Added -t/--tiny to treemap.py

Even though I think this makes less sense for the ascii-rendering
scripts, it's useful to have this flag around when jumping between
treemap.py and treemapd3.py.

And it might actually make sense sometimes now that -t/--tiny does not
override --to-scale.
This commit is contained in:
Christopher Haster
2025-03-10 23:17:11 -05:00
parent 92ac2a757e
commit 3d355d7783
2 changed files with 13 additions and 2 deletions
+11
View File
@@ -717,6 +717,7 @@ def main(csv_paths, *,
no_stats=False, no_stats=False,
to_scale=None, to_scale=None,
aspect_ratio=(1,1), aspect_ratio=(1,1),
tiny=False,
title=None, title=None,
padding=0, padding=0,
label=False, label=False,
@@ -729,6 +730,12 @@ def main(csv_paths, *,
else: else:
color = False color = False
# tiny mode?
if tiny:
if to_scale is None:
to_scale = 1
no_header = True
# what chars/colors/labels to use? # what chars/colors/labels to use?
chars_ = [] chars_ = []
for char in chars: for char in chars:
@@ -1155,6 +1162,10 @@ if __name__ == "__main__":
tuple(float(v) for v in x.split(':', 1)) tuple(float(v) for v in x.split(':', 1))
if ':' in x else (float(x), 1)), if ':' in x else (float(x), 1)),
help="Aspect ratio to use with --to-scale. Defaults to 1:1.") help="Aspect ratio to use with --to-scale. Defaults to 1:1.")
parser.add_argument(
'-t', '--tiny',
action='store_true',
help="Tiny mode, alias for --to-scale=1 and --no-header.")
parser.add_argument( parser.add_argument(
'--title', '--title',
help="Add a title. Accepts %% modifiers.") help="Add a title. Accepts %% modifiers.")
+2 -2
View File
@@ -567,11 +567,11 @@ def main(csv_paths, output, *,
no_stats=False, no_stats=False,
to_scale=None, to_scale=None,
aspect_ratio=(1,1), aspect_ratio=(1,1),
tiny=False,
nested=False,
title=None, title=None,
padding=1, padding=1,
no_label=False, no_label=False,
tiny=False,
nested=False,
dark=False, dark=False,
font=FONT, font=FONT,
font_size=FONT_SIZE, font_size=FONT_SIZE,