Skip to content

Commit

Permalink
Allow disabling of "readable numbers"
Browse files Browse the repository at this point in the history
Per mkaz#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.
  • Loading branch information
rjp committed Mar 14, 2023
1 parent 4aa3b67 commit 4aed3ca
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions termgraph/termgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 4aed3ca

Please sign in to comment.