Skip to content

feat: add persistent TOML configuration file support - #16

Closed
AndPuQing wants to merge 1 commit into
mainfrom
agent/pi/d670a435
Closed

feat: add persistent TOML configuration file support#16
AndPuQing wants to merge 1 commit into
mainfrom
agent/pi/d670a435

Conversation

@AndPuQing

Copy link
Copy Markdown
Owner

Stage 4: 配置文件支持 (W-211)

Adds persistent TOML configuration support for iotop defaults.

Changes

  • New src/config.rs: loads defaults from $IOTOP_CONFIG, $XDG_CONFIG_HOME/iotop/config.toml, or ~/.config/iotop/config.toml; a missing file is not an error, an invalid one is.
  • CLI precedence: Config::merge_cli overlays explicitly-given command-line arguments on top of file defaults.
  • Supported keys: delay, iterations, only, processes, accumulated, batch, pid, user, time, quiet, kilobytes, json, csv, plus interactive [sort] (column/reverse) and columns (displayed table columns).
  • Interactive defaults: config now drives the initial sort column/direction and the set of table columns (state.columns), with the table render refactored to be column-driven.
  • Docs: README section, man page CONFIGURATION section, and a fully-commented example at assets/config.example.toml.
  • Tests: unit tests for parsing, defaults, merge precedence, column parsing, path resolution, and effective_columns.

Acceptance

  • cargo test --locked --all-features --workspace — all pass (unit + 6 integration).
  • cargo clippy --all-targets --all-features --workspace -- -D warnings — clean.
  • cargo fmt --all --check — clean.

Note

The docs CI job is already red on main due to pre-existing rustdoc warnings in src/proc_reader.rs ([pid]/[tid]/private-link in doc comments) — unrelated to this change; this PR adds no new doc warnings.

Read defaults from $IOTOP_CONFIG, $XDG_CONFIG_HOME/iotop/config.toml, or
~/.config/iotop/config.toml. Command-line arguments always take precedence.
Supports delay, iterations, pids/users filters, output flags, interactive
default sort order ([sort] column/reverse) and the set of interactive table
columns. Includes a shipped example, docs, and unit tests.
@AndPuQing

Copy link
Copy Markdown
Owner Author

按维护者要求撤掉配置文件功能(未合并,直接关闭);main 不受影响。

@AndPuQing AndPuQing closed this Aug 8, 2026
@AndPuQing
AndPuQing deleted the agent/pi/d670a435 branch August 8, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant