From 4aed3ca0d7c51266935663c6199a2b46fb6591e2 Mon Sep 17 00:00:00 2001 From: rjp Date: Tue, 14 Mar 2023 13:18:24 +0000 Subject: [PATCH] Allow disabling of "readable numbers" Per #98, and for my own graphs, disabling "readable numbers" can make a huge difference in readability to the graph.o Adds an option `--no-readable` which presents numbers as-is. --- termgraph/termgraph.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/termgraph/termgraph.py b/termgraph/termgraph.py index 9facbdd..a8cd009 100755 --- a/termgraph/termgraph.py +++ b/termgraph/termgraph.py @@ -103,6 +103,9 @@ def init_args() -> Dict: parser.add_argument( "--version", action="store_true", help="Display version and exit" ) + parser.add_argument( + "--no-readable", action="store_true", help="Disable the readable numbers" + ) if len(sys.argv) == 1: if sys.stdin.isatty(): parser.print_usage() @@ -317,8 +320,11 @@ def horiz_rows( if args["no_values"]: tail = args["suffix"] else: - val, deg = cvt_to_readable(values[j]) - tail = fmt.format(args["format"].format(val), deg, args["suffix"]) + if not args.get("no_readable"): + val, deg = cvt_to_readable(values[j]) + tail = fmt.format(args["format"].format(val), deg, args["suffix"]) + else: + tail = fmt.format(args["format"].format(values[j]), "", args["suffix"]) if colors: color = colors[j]