From 9df9f0c41ea6aa59cb34151c0505f6fae36ef12e Mon Sep 17 00:00:00 2001 From: euxane Date: Mon, 25 Nov 2024 01:09:48 +0100 Subject: cli: combine min/max into range arg --- main.nim | 6 ++++-- readme.md | 14 ++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/main.nim b/main.nim index e93e144..3128bac 100644 --- a/main.nim +++ b/main.nim @@ -66,8 +66,10 @@ proc main() = of "unicode", "utf8", "utf-8": symbols = UNICODE_SYMBOLS of "numeric", "ascii": symbols = NUMERIC_SYMBOLS - of "min": min = parseInt(val) - of "max": max = parseInt(val) + of "range": + let parts = val.split(':', 1) + if parts.len != 2: raise newException(ValueError, "Invalid range") + (min, max) = (parseInt(parts[0]), parseInt(parts[1])) of "ping": let targetIp = resolve(val) diff --git a/readme.md b/readme.md index 692a464..c82ba18 100644 --- a/readme.md +++ b/readme.md @@ -5,7 +5,7 @@ Demo ---- ```terminal -❯ tickwatch --max=100000 --change=/sys/class/net/enp2s0/statistics/rx_packets +❯ tickwatch --range=0:100000 --change=/sys/class/net/enp2s0/statistics/rx_packets 2024-11-24 22:43+0100 ..............._______▁_______▁___▁__▁▁▁_____▁_▁___▂______▂_ 2024-11-24 22:44+0100 _______▁___▁_____▂_____________________▂▃▂▅▆▆▂▂▄▄▄▅▇▇▇▆▆▆▇▇▇ 2024-11-24 22:45+0100 ▇▆▆▆▆▆▆▆▇▇▇▇▇▇▇▇▇▇▇▇_____▂___________▁_________________▁___▅ @@ -31,12 +31,11 @@ Monitor options: --change=PATH Monitor changes in a sysfs file's value Display options: + --range=MIN:MAX Set range of values (default: 0:1000) --scale=CHOICE Set scaling method for values Choices: log2 (default), log10, ln, linear --symbols=CHOICE Set output symbol set Choices: unicode (default), numeric - --min=VALUE Set minimum value for scaling (default: 0) - --max=VALUE Set maximum value for scaling (default: 1000) Other options: --help, -h Display this help message @@ -45,11 +44,11 @@ Other options: Examples: tickwatch --ping=6/euxane.net - tickwatch --scale=linear --max=50000 \ - --value=/sys/class/thermal/thermal_zone0/temp - - tickwatch --max=100000 \ + tickwatch --range=0:100000 \ --change=/sys/class/net/eth0/statistics/rx_packets + + tickwatch --scale=linear --range=0:50000 \ + --value=/sys/class/thermal/thermal_zone0/temp ``` @@ -57,7 +56,6 @@ Packages -------- * Distribution packages: - * Running the latest development version with Nix: `nix run 'git+https://cgit.euxane.net/tickwatch?ref=main' -- --help` -- cgit v1.2.3