Deduplicate the `--yes`/non-interactive-terminal refusal guard (three near-identical copies)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Đọc ba vị trí gọi trong apps/rocm/src/uninstall.rs, apps/rocm/src/storage.rs (approved()), và apps/rocm/src/runtimes_cmd.rs, sau đó kiểm tra nhóm CLI trong AGENTS.md để tìm các thành phần UI dùng chung. Thêm guard dùng chung và cập nhật các vị trí gọi đó, giữ nguyên tên hành động và cách diễn đạt lỗi riêng biệt; ghi lại helper trong AGENTS.md. Hoàn tất khi cả ba đều dùng helper và therock.rs vẫn giữ hành vi phê duyệt riêng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Three call sites hand-roll the same guard before a mutating action that needs a terminal to confirm in, each re-deriving: check yes/--yes first, then interactive_terminal(), then bail with the same wording template parameterized only by the action name:
apps/rocm/src/uninstall.rs:76-77—if !interactive_terminal() { bail!("uninstall requires --yes outside an interactive terminal"); }apps/rocm/src/storage.rs:883-884(approved()) —if !interactive_terminal() { bail!("{action} requires --yes outside an interactive terminal"); }apps/rocm/src/runtimes_cmd.rs:192-193—if !interactive_terminal() { bail!("runtimes uninstall requires --yes outside an interactive terminal"); }
A natural shared helper collapses this into one place, e.g. something like fn require_yes_or_interactive(yes: bool, action: &str) -> Result<bool> returning whether to proceed and raising the same "requires --yes outside an interactive terminal" error with the caller's action name — so a fourth call site reaches for it instead of re-deriving the pattern again.
Deliberately excluding apps/rocm/src/therock.rs's sdk_install_approval/refuse_non_interactive_message: that non-interactive refusal is intentionally richer (it names --approve-replacing-active-default vs --yes specifically, since the two consents aren't interchangeable there), and collapsing it into the generic wording would lose that distinction — not a candidate for this helper.
Surfaced while scoping #769 (deduplicating the [y/N] prompt itself) — same audit family, filed separately since it's an independent call-site pattern rather than the prompt helper itself.
Documentation: once this lands, add a bullet for the new guard helper to AGENTS.md's "Shared UI components" section (CLI group), alongside the [y/N] prompt helper from #769.
- Ngôn ngữ chính
- Rust
- Star
- 49
- Fork
- 14
- Merge trung bình
- 3 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 174
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ROCm/rocm-cli
-
enhancement ux-opportunities
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement ux-opportunities
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Move the remaining `scripts/` tooling to Rust (`cargo xtask` / e2e scenarios)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
examine: lspci cannot name a GPU that pci.ids does not know, though the device id is on the lineCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của ROCm/rocm-cli
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
FalkorDB/FalkorDB#3597 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
mozilla-services/syncstorage-rs#2715 ·
Maintainer thường phản hồi trong vòng 1 ngày