(key: &str, yes: bool)
| 6157 | } |
| 6158 | |
| 6159 | fn confirm_global_setting_takeover(key: &str, yes: bool) -> Result<()> { |
| 6160 | if yes { |
| 6161 | return Ok(()); |
| 6162 | } |
| 6163 | |
| 6164 | if !std::io::stdin().is_terminal() || !std::io::stdout().is_terminal() { |
| 6165 | return Err(miette::miette!( |
| 6166 | "global setting updates require confirmation; pass --yes in non-interactive mode" |
| 6167 | )); |
| 6168 | } |
| 6169 | |
| 6170 | let proceed = Confirm::with_theme(&ColorfulTheme::default()) |
| 6171 | .with_prompt(format!( |
| 6172 | "Setting '{key}' globally will disable sandbox-level management for this key. Continue?" |
| 6173 | )) |
| 6174 | .default(false) |
| 6175 | .interact() |
| 6176 | .into_diagnostic()?; |
| 6177 | |
| 6178 | if !proceed { |
| 6179 | return Err(miette::miette!("aborted by user")); |
| 6180 | } |
| 6181 | |
| 6182 | Ok(()) |
| 6183 | } |
| 6184 | |
| 6185 | fn confirm_global_setting_delete(key: &str, yes: bool) -> Result<()> { |
| 6186 | if yes { |
no test coverage detected