Skip to content

Commit 5f98f2f

Browse files
VincentZyuwin11台式机VincentZyuwin11台式机
authored andcommitted
feat: --max & --smart-max mutual exclusion + Y-axis scaling docs
- Bump version: 0.1.8-beta.2 0.1.8-beta.3 (Rust + Python) - Rust: add conflicts_with = smart_max on --max (clap) - Python: group --max & --smart-max in mutually_exclusive_group() - Reorder --smart-max adjacent to --max in Options table (5 READMEs) - Add conflict annotations to --max & --smart-max descriptions - Add Y-axis scaling mode blockquote (fixed max / smart max / history peak) with conflict warning across all 5 READMEs (en, zh-cn, zh-tw, jp, ko) build publish, pypi publish, crates publish
1 parent 761e3c4 commit 5f98f2f

9 files changed

Lines changed: 74 additions & 23 deletions

File tree

py/main.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,24 @@ def parse_args() -> argparse.Namespace:
203203
default="bit",
204204
help=t("help_unit"),
205205
)
206-
parser.add_argument(
206+
max_group = parser.add_mutually_exclusive_group()
207+
max_group.add_argument(
207208
"-m",
208209
"--max",
209210
type=str,
210211
default=None,
211212
metavar="VALUE",
212213
help=t("help_max"),
213214
)
215+
max_group.add_argument(
216+
"--smart-max",
217+
type=float,
218+
nargs="?",
219+
const=10.0,
220+
default=None,
221+
metavar="SECS",
222+
help=t("help_smart_max"),
223+
)
214224
parser.add_argument(
215225
"-n",
216226
"--no-graph",
@@ -266,15 +276,6 @@ def parse_args() -> argparse.Namespace:
266276
default=False,
267277
help=t("help_no_color"),
268278
)
269-
parser.add_argument(
270-
"--smart-max",
271-
type=float,
272-
nargs="?",
273-
const=10.0,
274-
default=None,
275-
metavar="SECS",
276-
help=t("help_smart_max"),
277-
)
278279
parser.add_argument(
279280
"--debug-info",
280281
action="store_true",

py/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "winload"
3-
version = "0.1.8-beta.2"
3+
version = "0.1.8-beta.3"
44
description = "Network Load Monitor - nload-like TUI tool for Windows"
55
readme = "readme.md"
66
license = { text = "MIT" }

readme.jp.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,26 @@ winload --npcap # 127.0.0.1 ループバックトラフィックをキャ
170170
| `-b`, `--bar-style <STYLE>` | バースタイル: `fill`, `color`, `plain` | `fill` |
171171
| `--in-color <HEX>` | 受信グラフの色、16進数RGB (例: `0x00d7ff`) | シアン |
172172
| `--out-color <HEX>` | 送信グラフの色、16進数RGB (例: `0xffaf00`) | ゴールド |
173-
| `-m`, `--max <VALUE>` | Y軸の最大値を固定 (例: `10M`, `1G`, `500K`) | 自動 |
173+
| `-m`, `--max <VALUE>` | Y軸の最大値を固定 (例: `10M`, `1G`, `500K`) —— *`--smart-max` と併用不可* | 自動 |
174+
| `--smart-max [SECS]` | スマート適応型Y軸上限:トラフィックスパイク後に自動的に指数減衰し、波形がより動的に(半減期、秒、デフォルト10秒)—— *`--max` と併用不可* | オフ |
174175
| `-n`, `--no-graph` | グラフを非表示にし、統計のみを表示 | オフ |
175176
| `--hide-separator` | 区切り線(イコール記号の行)を非表示にする | オフ |
176177
| `--no-color` | すべてのTUIカラーを無効にする(モノクロモード) | オフ |
177-
| `--smart-max [SECS]` | スマート適応型Y軸上限:トラフィックスパイク後に自動的に指数減衰し、波形がより動的に(半減期、秒、デフォルト10秒) | オフ |
178178
| `--npcap` | **[Windows Rust版のみ]** Npcap経由でループバックをキャプチャ | オフ |
179179
| `--debug-info` | インターフェースのデバッグ情報を表示して終了 ||
180180
| `-h`, `--help` | ヘルプを表示 (`--help --emoji` で絵文字版ヘルプ!) ||
181181
| `-V`, `--version` | バージョンを表示 ||
182182

183+
> **Y軸スケーリングモード** —— 以下の3つのシナリオは排他的です:
184+
>
185+
> | モード | フラグ | 動作 |
186+
> |--------|--------|------|
187+
> | **固定最大値** | `--max <VALUE>` | Y軸を指定した値に固定します(例:`10M``1G`)。 |
188+
> | **スマート最大値** | `--smart-max [SECS]` | Y軸が自動適応:トラフィック急増時に即座に上昇し、その後スムーズに減衰します(指数減衰、デフォルト半減期 10 秒)。 |
189+
> | **履歴ピーク** | *(どちらも指定なし)* | Y軸は各指標の過去最大値に追従します —— デフォルトの動作です。 |
190+
>
191+
> ⚠️ `--max``--smart-max`**併用不可**です —— どちらか一方のみ指定できます。
192+
183193
### キーボードショートカット
184194

185195
| キー | アクション |

readme.ko.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,26 @@ winload --npcap # 127.0.0.1 루프백 트래픽 캡처 (Windows, Npcap 필
170170
| `-b`, `--bar-style <STYLE>` | 바 스타일: `fill`, `color`, 또는 `plain` | `fill` |
171171
| `--in-color <HEX>` | 수신 그래프 색상, 16진수 RGB (예: `0x00d7ff`) | Cyan |
172172
| `--out-color <HEX>` | 송신 그래프 색상, 16진수 RGB (예: `0xffaf00`) | Gold |
173-
| `-m`, `--max <VALUE>` | Y축 최대값 고정 (예: `10M`, `1G`, `500K`) | 자동 |
173+
| `-m`, `--max <VALUE>` | Y축 최대값 고정 (예: `10M`, `1G`, `500K`) —— *`--smart-max`와 충돌* | 자동 |
174+
| `--smart-max [SECS]` | 스마트 적응형 Y축 상한: 트래픽 스파이크 후 자동으로 지수 감쇠하여 파형이 더 생동감 있게 표시 (반감기, 초, 기본값 10초) —— *`--max`와 충돌* | 비활성 |
174175
| `-n`, `--no-graph` | 그래프를 숨기고 통계만 표시 | 비활성 |
175176
| `--hide-separator` | 구분선(등호 행) 숨기기 | 비활성 |
176177
| `--no-color` | 모든 TUI 색상 비활성화 (흑백 모드) | 비활성 |
177-
| `--smart-max [SECS]` | 스마트 적응형 Y축 상한: 트래픽 스파이크 후 자동으로 지수 감쇠하여 파형이 더 생동감 있게 표시 (반감기, 초, 기본값 10초) | 비활성 |
178178
| `--npcap` | **[Windows Rust 버전 전용]** Npcap을 통해 루프백 트래픽 캡처 | 비활성 |
179179
| `--debug-info` | 네트워크 인터페이스 디버그 정보 출력 후 종료 ||
180180
| `-h`, `--help` | 도움말 출력 (`--help --emoji`로 이모지 버전 확인 가능!) ||
181181
| `-V`, `--version` | 버전 정보 출력 ||
182182

183+
> **Y축 스케일링 모드** — 다음 세 가지 시나리오는 상호 배타적입니다:
184+
>
185+
> | 모드 | 플래그 | 동작 |
186+
> |------|--------|------|
187+
> | **고정 최댓값** | `--max <VALUE>` | Y축을 지정한 값으로 고정합니다 (예: `10M`, `1G`). |
188+
> | **스마트 최댓값** | `--smart-max [SECS]` | Y축이 자동 적응: 트래픽 급증 시 즉시 상승한 뒤, 부드럽게 감쇠합니다 (지수 감쇠, 기본 반감기 10초). |
189+
> | **히스토리 피크** | *(둘 다 미지정)* | Y축이 각 지표의 과거 최댓값을 따릅니다 — 기본 동작입니다. |
190+
>
191+
> ⚠️ `--max``--smart-max`**서로 충돌**합니다 — 둘 중 하나만 사용할 수 있습니다.
192+
183193
### 키보드 단축키
184194

185195
|| 동작 |

readme.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,26 @@ winload --npcap # Capture 127.0.0.1 loopback traffic (Windows, requires Npc
170170
| `-b`, `--bar-style <STYLE>` | Bar style: `fill`, `color`, or `plain` | `fill` |
171171
| `--in-color <HEX>` | Incoming graph color, hex RGB (e.g. `0x00d7ff`) | cyan |
172172
| `--out-color <HEX>` | Outgoing graph color, hex RGB (e.g. `0xffaf00`) | gold |
173-
| `-m`, `--max <VALUE>` | Fixed Y-axis max (e.g. `10M`, `1G`, `500K`) | auto |
173+
| `-m`, `--max <VALUE>` | Fixed Y-axis max (e.g. `10M`, `1G`, `500K`) — *conflicts with `--smart-max`* | auto |
174+
| `--smart-max [SECS]` | Smart adaptive Y-axis: auto-decays after traffic spikes (default half-life: 10s) — *conflicts with `--max`* | off |
174175
| `-n`, `--no-graph` | Hide graph, show stats only | off |
175176
| `--hide-separator` | Hide the separator line (row of equals signs) | off |
176177
| `--no-color` | Disable all TUI colors (monochrome mode) | off |
177-
| `--smart-max [SECS]` | Smart adaptive Y-axis: auto-decays after traffic spikes (default half-life: 10s) | off |
178178
| `--npcap` | **[Windows Rust Only]** Capture loopback traffic via Npcap (recommended) | off |
179179
| `--debug-info` | Print network interface debug info and exit ||
180180
| `-h`, `--help` | Print help (`--help --emoji` for emoji version!) ||
181181
| `-V`, `--version` | Print version ||
182182

183+
> **Y-axis scaling modes** — there are three mutually exclusive scenarios:
184+
>
185+
> | Mode | Flag | Behavior |
186+
> |------|------|----------|
187+
> | **Fixed max** | `--max <VALUE>` | Y-axis is locked to the specified value (e.g. `10M`, `1G`). |
188+
> | **Smart max** | `--smart-max [SECS]` | Y-axis adapts automatically: jumps up on traffic spikes, then smoothly decays back down (exponential decay, default half-life 10 s). |
189+
> | **History peak** | *(neither flag)* | Y-axis follows the historical maximum of each metric — the default behavior. |
190+
>
191+
> ⚠️ `--max` and `--smart-max` **conflict with each other** — you can only use one at a time.
192+
183193
### Keyboard Shortcuts
184194

185195
| Key | Action |

readme.zh-cn.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,26 @@ winload --npcap # 捕获 127.0.0.1 回环流量 (Windows,需安装 Npcap)
170170
| `-b`, `--bar-style <STYLE>` | 状态栏样式:`fill``color``plain` | `fill` |
171171
| `--in-color <HEX>` | 下行图形颜色,十六进制 RGB(如 `0x00d7ff`| 青色 |
172172
| `--out-color <HEX>` | 上行图形颜色,十六进制 RGB(如 `0xffaf00`| 金色 |
173-
| `-m`, `--max <VALUE>` | 固定 Y 轴最大值(如 `10M``1G``500K`| 自动 |
173+
| `-m`, `--max <VALUE>` | 固定 Y 轴最大值(如 `10M``1G``500K`)—— *`--smart-max` 冲突* | 自动 |
174+
| `--smart-max [SECS]` | 智能自适应 Y 轴上限:流量尖峰后自动指数回落,波形更生动(半衰期,秒,默认 10s)—— *`--max` 冲突* | 关闭 |
174175
| `-n`, `--no-graph` | 隐藏图形,仅显示统计信息 | 关闭 |
175176
| `--hide-separator` | 隐藏分隔线(等于号一行) | 关闭 |
176177
| `--no-color` | 禁用所有 TUI 颜色(单色模式) | 关闭 |
177-
| `--smart-max [SECS]` | 智能自适应 Y 轴上限:流量尖峰后自动指数回落,波形更生动(半衰期,秒,默认 10s) | 关闭 |
178178
| `--npcap` | **[Windows Rust Only]** 通过 Npcap 捕获回环流量(推荐) | 关闭 |
179179
| `--debug-info` | 打印网络接口调试信息后退出 ||
180180
| `-h`, `--help` | 打印帮助(`--help --emoji` 可查看 emoji 版!) ||
181181
| `-V`, `--version` | 打印版本号 ||
182182

183+
> **Y 轴缩放模式** —— 以下三种场景互斥:
184+
>
185+
> | 模式 | 参数 | 行为 |
186+
> |------|------|------|
187+
> | **固定最大值** | `--max <VALUE>` | Y 轴锁定为指定值(如 `10M``1G`)。 |
188+
> | **智能最大值** | `--smart-max [SECS]` | Y 轴自适应:流量突增时立即跳升,随后平滑衰减(指数衰减,默认半衰期 10 秒)。 |
189+
> | **历史峰值** | *(都不加)* | Y 轴跟随各指标的历史最大值 —— 这是默认行为。 |
190+
>
191+
> ⚠️ `--max``--smart-max` **相互冲突** —— 只能二选一。
192+
183193
### 快捷键
184194

185195
| 按键 | 功能 |

readme.zh-tw.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,26 @@ winload --npcap # 擷取 127.0.0.1 回環流量 (Windows,需安裝 Npcap)
170170
| `-b`, `--bar-style <STYLE>` | 狀態列樣式:`fill``color``plain` | `fill` |
171171
| `--in-color <HEX>` | 下行圖形顏色,十六進位 RGB(如 `0x00d7ff`| 青色 |
172172
| `--out-color <HEX>` | 上行圖形顏色,十六進位 RGB(如 `0xffaf00`| 金色 |
173-
| `-m`, `--max <VALUE>` | 固定 Y 軸最大值(如 `10M``1G``500K`| 自動 |
173+
| `-m`, `--max <VALUE>` | 固定 Y 軸最大值(如 `10M``1G``500K`)—— *`--smart-max` 衝突* | 自動 |
174+
| `--smart-max [SECS]` | 智慧自適應 Y 軸上限:流量尖峰後自動指數回落,波形更生動(半衰期,秒,預設 10s)—— *`--max` 衝突* | 關閉 |
174175
| `-n`, `--no-graph` | 隱藏圖形,僅顯示統計資訊 | 關閉 |
175176
| `--hide-separator` | 隱藏分隔線(等號一行) | 關閉 |
176177
| `--no-color` | 停用所有 TUI 顏色(單色模式) | 關閉 |
177-
| `--smart-max [SECS]` | 智慧自適應 Y 軸上限:流量尖峰後自動指數回落,波形更生動(半衰期,秒,預設 10s) | 關閉 |
178178
| `--npcap` | **[Windows Rust Only]** 透過 Npcap 擷取回環流量(建議) | 關閉 |
179179
| `--debug-info` | 列印網路介面除錯資訊後退出 ||
180180
| `-h`, `--help` | 列印說明(`--help --emoji` 可查看 emoji 版!) ||
181181
| `-V`, `--version` | 列印版本號 ||
182182

183+
> **Y 軸縮放模式** —— 以下三種情境互斥:
184+
>
185+
> | 模式 | 參數 | 行為 |
186+
> |------|------|------|
187+
> | **固定最大值** | `--max <VALUE>` | Y 軸鎖定為指定值(如 `10M``1G`)。 |
188+
> | **智慧最大值** | `--smart-max [SECS]` | Y 軸自適應:流量突增時立即跳升,隨後平滑衰減(指數衰減,預設半衰期 10 秒)。 |
189+
> | **歷史峰值** | *(都不加)* | Y 軸跟隨各指標的歷史最大值 —— 這是預設行為。 |
190+
>
191+
> ⚠️ `--max``--smart-max` **相互衝突** —— 只能二擇一。
192+
183193
### 快捷鍵
184194

185195
| 按鍵 | 功能 |

rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "winload"
3-
version = "0.1.8-beta.2"
3+
version = "0.1.8-beta.3"
44
edition = "2021"
55
description = "Network Load Monitor — nload-like TUI tool for Windows/Linux/macOS"
66
license = "MIT"

rust/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ struct Args {
127127
out_color: Option<ratatui::style::Color>,
128128

129129
/// Fixed graph Y-axis max (e.g. 100M, 1G, 500K)
130-
#[arg(short = 'm', long = "max", value_parser = parse_max_value)]
130+
#[arg(short = 'm', long = "max", value_parser = parse_max_value, conflicts_with = "smart_max")]
131131
max: Option<f64>,
132132

133133
/// Hide traffic graphs, show only statistics

0 commit comments

Comments
 (0)