| 2399 | } |
| 2400 | |
| 2401 | async fn handle_pr_command(number: u32) -> anyhow::Result<()> { |
| 2402 | let branch = format!("pr/{}", number); |
| 2403 | let status = ProcessCommand::new("gh") |
| 2404 | .args([ |
| 2405 | "pr", |
| 2406 | "checkout", |
| 2407 | &number.to_string(), |
| 2408 | "--branch", |
| 2409 | &branch, |
| 2410 | "--force", |
| 2411 | ]) |
| 2412 | .status() |
| 2413 | .map_err(|e| anyhow::anyhow!("Failed to run gh pr checkout: {}", e))?; |
| 2414 | if !status.success() { |
| 2415 | anyhow::bail!( |
| 2416 | "Failed to checkout PR #{}. Ensure gh is installed and authenticated.", |
| 2417 | number |
| 2418 | ); |
| 2419 | } |
| 2420 | println!("Checked out PR #{} as branch {}", number, branch); |
| 2421 | Ok(()) |
| 2422 | } |
| 2423 | |
| 2424 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| 2425 | enum InstallMethod { |