feat: add persistent TOML configuration file support - #16
Closed
AndPuQing wants to merge 1 commit into
Closed
Conversation
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.
Owner
Author
|
按维护者要求撤掉配置文件功能(未合并,直接关闭);main 不受影响。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage 4: 配置文件支持 (W-211)
Adds persistent TOML configuration support for iotop defaults.
Changes
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.Config::merge_clioverlays explicitly-given command-line arguments on top of file defaults.delay,iterations,only,processes,accumulated,batch,pid,user,time,quiet,kilobytes,json,csv, plus interactive[sort](column/reverse) andcolumns(displayed table columns).state.columns), with the table render refactored to be column-driven.CONFIGURATIONsection, and a fully-commented example atassets/config.example.toml.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
docsCI job is already red onmaindue to pre-existingrustdocwarnings insrc/proc_reader.rs([pid]/[tid]/private-link in doc comments) — unrelated to this change; this PR adds no new doc warnings.