Repository navigation
feat!: consolidate CLI options around --paging (0.10.0). - #14
Merged
Merged
Conversation
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.
変更理由
CLI のオプションを整理する。互換性を壊す変更を含むので 0.10.0 に上げる。
変更内容
互換性を壊す変更
-p, --pager/--no-pager--paging <auto|always|never>(既定auto)--plain--color neverを使う--images <WHEN>--images <MODE>にした(受け付ける値は同じ)--watchと組み合わせられないものは、--no-pagerから--paging neverに変わった。config のwatch = trueを黙って無視する条件も同じ。--pager --no-pager、--plain --color always。内部の整理
--color/--hyperlinks/--pagingの値の型を共通のWhenにまとめた(ColorWhenとHyperlinkWhenは同じ定義だった)。Cli::resolve(ctx) -> Settingsを追加した。フラグと端末の状態から決まるもの(出力先・色・リンク・画像・実効の mermaid mode など)を 1 回で解決し、main.rsはその結果を読むだけにした。config.rsにflag_keys!を置いた。Config・TOML の生の構造体・解析・Cliへの適用を、キー 1 行の表から生成する。前はキーを足すたびに 4 箇所を書き換える必要があった。--highlight <auto|never>は今のまま残した。bool の--no-highlightにすると、config にhighlight = "never"と書いた人がコマンドラインで ON に戻せなくなるため。影響範囲
src/cli.rs、src/config.rs、src/main.rs、tests/cli.rs、tests/render.rsREADME.md、docs/mermaid-image.md、.claude/rules/runtime.md/rendering.md確認手順
cargo test --all-features: 350 + 24 + 52 件が通った。pager::watchの 2 件は、sandbox の中では FSEvents が届かないため除外した(CI で確認する)。cargo clippy --all-targets --all-features -- -D warnings/cargo fmt --check: 通った。mdvu --helpに新しいオプション一覧が出る。mdvu --paging never --color never README.mdが stdout に出力する。mdvu --plain README.mdは exit 2 になり、--pagingを候補として示す。mdvu --watch --paging never README.mdは exit 2 になる。--paging alwaysで pager が開くことは unit test(output_mode)で確認した。実際の端末では確認していない。