(key: &str, yes: bool)
| 6183 | } |
| 6184 | |
| 6185 | fn confirm_global_setting_delete(key: &str, yes: bool) -> Result<()> { |
| 6186 | if yes { |
| 6187 | return Ok(()); |
| 6188 | } |
| 6189 | |
| 6190 | if !std::io::stdin().is_terminal() || !std::io::stdout().is_terminal() { |
| 6191 | return Err(miette::miette!( |
| 6192 | "global setting deletes require confirmation; pass --yes in non-interactive mode" |
| 6193 | )); |
| 6194 | } |
| 6195 | |
| 6196 | let proceed = Confirm::with_theme(&ColorfulTheme::default()) |
| 6197 | .with_prompt(format!( |
| 6198 | "Deleting global setting '{key}' re-enables sandbox-level management for this key. Continue?" |
| 6199 | )) |
| 6200 | .default(false) |
| 6201 | .interact() |
| 6202 | .into_diagnostic()?; |
| 6203 | |
| 6204 | if !proceed { |
| 6205 | return Err(miette::miette!("aborted by user")); |
| 6206 | } |
| 6207 | |
| 6208 | Ok(()) |
| 6209 | } |
| 6210 | |
| 6211 | fn parse_cli_setting_value(key: &str, raw_value: &str) -> Result<SettingValue> { |
| 6212 | let setting = settings::setting_for_key(key).ok_or_else(|| { |
no test coverage detected