CLI help を自己完結の説明に書き直し、library をサブコマンドとして統合する#108
Conversation
- Usage を 2 行化し、library サブコマンドを risundle --help から発見できるようにする - --help の末尾に登録 → バンドルの Examples を載せる (-h には出さない) - -c と -k の既定値 (g++ / std) を 1 行目に明記する - --no-tree-shaking のフォールバック用途と --keep との違い、add-std の加算式の挙動、 .risundlerc.toml の存在を長い help の 2 段落目で説明する - show -v の説明に実装先の名前 (implementation target names) を追加する (v2 追随漏れ) - help 内のバッククォートを全廃する Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
risundle --help の Commands セクションに library が本物のサブコマンドとして 現れるようにする。従来は argv の先頭を見て 2 つの独立したパーサへ振り分けて いたため、help に library が出ず末尾の案内文で補っていた。 clap の subcommand_negates_reqs + args_conflicts_with_subcommands で 必須 positional <FILE> と optional subcommand を共存させる。<FILE> は この都合で Option 型になるが required は維持され、バンドル経路では clap が存在を保証する。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
Walkthroughトップレベルの ChangesCLIサブコマンド統合
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant Cli
participant main
participant LibraryRun as commands::library::run
participant BundleRun as commands::bundle::run
User->>Cli: CLI引数を入力
Cli->>main: Cli::parse() の結果
alt libraryサブコマンド
main->>LibraryRun: LibraryCommandを渡す
else bundle処理
main->>BundleRun: BundleArgsを渡す
BundleRun->>BundleRun: fileを確定
end
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
GNU Coding Standards の「--version は他のオプションや引数に優先して バージョンを表示し、成功終了する」に合わせ、propagate_version で全 サブコマンドに -V/--version を生やす。表示名の既定はハイフン結合 (risundle-library 等) で実在しないバイナリ名を名乗ってしまい、clap は display_name を伝播しないため、全サブコマンドで risundle に上書きする。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@coderabbitai review |
✅ Action performedReview finished.
|
Resolves #26
概要
CLI help を「その場で読み切れる自己完結の説明」に書き直し、library をトップレベルのサブコマンドとしてパーサに統合しました。Issue のコメントに整理した 10 項目すべてに対応しています。
変更内容
help の書き直し (docs)
-cと-kの既定値 (g++/std) を説明の 1 行目に明記--help) の 2 段落目に文脈を追加: keep の合成規則、--no-tree-shakingのフォールバック用途と--keepとの違い、add-stdの加算式の挙動、.risundlerc.tomlの存在--helpの末尾に登録 → バンドルの Examples を追加 (-hには出さず一覧性を維持)show -vの説明に実装先の名前 (implementation target names) を追加 (v2 追随漏れ)パーサ統合 (feat)
risundle --helpの Commands セクションに library が本物のサブコマンドとして現れるようにしました。従来は argv の先頭を見て 2 つの独立したパーサへ振り分けていたため、help に library が出ず末尾の案内文で補う案を Issue コメントでは示していましたが、走査で発見できる本物のセクションの方が UX 上優れると判断し、統合まで進めました。subcommand_negates_reqs+args_conflicts_with_subcommandsで必須 positional<FILE>と optional subcommand を共存させる<FILE>は clap の都合でOption<PathBuf>になるがrequired = trueは維持され、バンドル経路では clap が存在を保証するLibraryCliを廃止し、architecture.md の記述を追随--version の GNU 対応 (feat)
GNU Coding Standards の「
--versionは他のオプションや引数に優先してバージョンを表示し、成功終了する」に合わせ、どの階層で打っても risundle 本体のバージョンを答えるようにしました。risundle library add -Vのような打ちかけのコマンド (必須引数の欠落を含む) でもrisundle 2.0.0を表示して exit 0risundle library -Vはrisundle library 2.0.0という表示でしたが、バージョンは本体で 1 つなので表示名もrisundleに統一 (clap 既定のハイフン結合risundle-libraryは実在しないバイナリ名を名乗るためdisplay_nameで上書き)補足
risundle librray ...) は従来「ファイルが読めない」という見当違いのエラーでしたが、parse 時の引数エラー (usage 付き) になりましたテスト
<FILE>必須・フラグとの競合・全階層の--version)cargo fmt --check/cargo test(219 件全通過) /cargo clippy --all-targets(pedantic) を確認-h/--help/library --help/ 各サブコマンドの help と、全階層の-V/--versionの実出力を目視確認🤖 Generated with Claude Code