This commit is contained in:
kevin zhao
2025-12-02 00:15:26 -05:00
parent 4a9089294f
commit 48e424c7d4
2 changed files with 6 additions and 14 deletions

View File

@@ -1677,11 +1677,7 @@ mod handlers {
}
}
pub async fn exec_approval(
sess: &Arc<Session>,
id: String,
decision: ReviewDecision,
) {
pub async fn exec_approval(sess: &Arc<Session>, id: String, decision: ReviewDecision) {
if let ReviewDecision::ApprovedAllowPrefix { allow_prefix } = &decision
&& let Err(err) = sess.persist_command_allow_prefix(allow_prefix).await
{

View File

@@ -162,16 +162,10 @@ impl ApprovalOverlay {
};
if let Some(variant) = self.current_variant.as_ref() {
match (variant, &option.decision) {
(
ApprovalVariant::Exec { id, command, .. },
ApprovalDecision::Review(decision),
) => {
(ApprovalVariant::Exec { id, command, .. }, ApprovalDecision::Review(decision)) => {
self.handle_exec_decision(id, command, decision.clone());
}
(
ApprovalVariant::ApplyPatch { id, .. },
ApprovalDecision::Review(decision),
) => {
(ApprovalVariant::ApplyPatch { id, .. }, ApprovalDecision::Review(decision)) => {
self.handle_patch_decision(id, decision.clone());
}
(
@@ -494,7 +488,9 @@ fn exec_options(allow_prefix: Option<Vec<String>>) -> Vec<ApprovalOption> {
.into_iter()
.chain(allow_prefix.map(|prefix| ApprovalOption {
label: "Yes, and don't ask again for commands with this prefix".to_string(),
decision: ApprovalDecision::Review(ReviewDecision::ApprovedAllowPrefix { allow_prefix: prefix }),
decision: ApprovalDecision::Review(ReviewDecision::ApprovedAllowPrefix {
allow_prefix: prefix,
}),
display_shortcut: None,
additional_shortcuts: vec![key_hint::plain(KeyCode::Char('p'))],
}))