use nu_plugin::{EvaluatedCall, LabeledError}; use nu_protocol::Value; use crate::DialogPlugin; impl DialogPlugin { pub(crate) fn confirm( &self, call: &EvaluatedCall, _input: &Value, ) -> Result { let prompt: String = call.req(0)?; let default_val: Option = call.get_flag("default")?; let mut confirm = dialoguer::Confirm::with_theme(&*self.theme); confirm.with_prompt(prompt); if let Some(val) = default_val { confirm.default(val); } let result = confirm.interact().map_err(|e| LabeledError { label: "Failed to prompt user".into(), msg: e.to_string(), span: Some(call.head), })?; Ok(Value::Bool { val: result, span: call.head, }) } }