diff options
author | euxane | 2024-11-25 01:09:48 +0100 |
---|---|---|
committer | euxane | 2024-11-25 01:09:48 +0100 |
commit | 9df9f0c41ea6aa59cb34151c0505f6fae36ef12e (patch) | |
tree | 44f1531319354a89b4689291e5a3024473527466 | |
parent | 4cd66c433da6e95ee8869e954f835c5ecf4bd8d0 (diff) | |
download | tickwatch-9df9f0c41ea6aa59cb34151c0505f6fae36ef12e.tar.gz |
cli: combine min/max into range argv2.0
-rw-r--r-- | main.nim | 6 | ||||
-rw-r--r-- | readme.md | 14 |
2 files changed, 10 insertions, 10 deletions
@@ -66,8 +66,10 @@ proc main() = | |||
66 | of "unicode", "utf8", "utf-8": symbols = UNICODE_SYMBOLS | 66 | of "unicode", "utf8", "utf-8": symbols = UNICODE_SYMBOLS |
67 | of "numeric", "ascii": symbols = NUMERIC_SYMBOLS | 67 | of "numeric", "ascii": symbols = NUMERIC_SYMBOLS |
68 | 68 | ||
69 | of "min": min = parseInt(val) | 69 | of "range": |
70 | of "max": max = parseInt(val) | 70 | let parts = val.split(':', 1) |
71 | if parts.len != 2: raise newException(ValueError, "Invalid range") | ||
72 | (min, max) = (parseInt(parts[0]), parseInt(parts[1])) | ||
71 | 73 | ||
72 | of "ping": | 74 | of "ping": |
73 | let targetIp = resolve(val) | 75 | let targetIp = resolve(val) |
@@ -5,7 +5,7 @@ Demo | |||
5 | ---- | 5 | ---- |
6 | 6 | ||
7 | ```terminal | 7 | ```terminal |
8 | ❯ tickwatch --max=100000 --change=/sys/class/net/enp2s0/statistics/rx_packets | 8 | ❯ tickwatch --range=0:100000 --change=/sys/class/net/enp2s0/statistics/rx_packets |
9 | 2024-11-24 22:43+0100 ..............._______▁_______▁___▁__▁▁▁_____▁_▁___▂______▂_ | 9 | 2024-11-24 22:43+0100 ..............._______▁_______▁___▁__▁▁▁_____▁_▁___▂______▂_ |
10 | 2024-11-24 22:44+0100 _______▁___▁_____▂_____________________▂▃▂▅▆▆▂▂▄▄▄▅▇▇▇▆▆▆▇▇▇ | 10 | 2024-11-24 22:44+0100 _______▁___▁_____▂_____________________▂▃▂▅▆▆▂▂▄▄▄▅▇▇▇▆▆▆▇▇▇ |
11 | 2024-11-24 22:45+0100 ▇▆▆▆▆▆▆▆▇▇▇▇▇▇▇▇▇▇▇▇_____▂___________▁_________________▁___▅ | 11 | 2024-11-24 22:45+0100 ▇▆▆▆▆▆▆▆▇▇▇▇▇▇▇▇▇▇▇▇_____▂___________▁_________________▁___▅ |
@@ -31,12 +31,11 @@ Monitor options: | |||
31 | --change=PATH Monitor changes in a sysfs file's value | 31 | --change=PATH Monitor changes in a sysfs file's value |
32 | 32 | ||
33 | Display options: | 33 | Display options: |
34 | --range=MIN:MAX Set range of values (default: 0:1000) | ||
34 | --scale=CHOICE Set scaling method for values | 35 | --scale=CHOICE Set scaling method for values |
35 | Choices: log2 (default), log10, ln, linear | 36 | Choices: log2 (default), log10, ln, linear |
36 | --symbols=CHOICE Set output symbol set | 37 | --symbols=CHOICE Set output symbol set |
37 | Choices: unicode (default), numeric | 38 | Choices: unicode (default), numeric |
38 | --min=VALUE Set minimum value for scaling (default: 0) | ||
39 | --max=VALUE Set maximum value for scaling (default: 1000) | ||
40 | 39 | ||
41 | Other options: | 40 | Other options: |
42 | --help, -h Display this help message | 41 | --help, -h Display this help message |
@@ -45,11 +44,11 @@ Other options: | |||
45 | Examples: | 44 | Examples: |
46 | tickwatch --ping=6/euxane.net | 45 | tickwatch --ping=6/euxane.net |
47 | 46 | ||
48 | tickwatch --scale=linear --max=50000 \ | 47 | tickwatch --range=0:100000 \ |
49 | --value=/sys/class/thermal/thermal_zone0/temp | ||
50 | |||
51 | tickwatch --max=100000 \ | ||
52 | --change=/sys/class/net/eth0/statistics/rx_packets | 48 | --change=/sys/class/net/eth0/statistics/rx_packets |
49 | |||
50 | tickwatch --scale=linear --range=0:50000 \ | ||
51 | --value=/sys/class/thermal/thermal_zone0/temp | ||
53 | ``` | 52 | ``` |
54 | 53 | ||
55 | 54 | ||
@@ -57,7 +56,6 @@ Packages | |||
57 | -------- | 56 | -------- |
58 | 57 | ||
59 | * Distribution packages: <https://repology.org/project/tickwatch> | 58 | * Distribution packages: <https://repology.org/project/tickwatch> |
60 | |||
61 | * Running the latest development version with Nix: | 59 | * Running the latest development version with Nix: |
62 | `nix run 'git+https://cgit.euxane.net/tickwatch?ref=main' -- --help` | 60 | `nix run 'git+https://cgit.euxane.net/tickwatch?ref=main' -- --help` |
63 | 61 | ||