返回 CodeWhale
hooks.rs
1 #[derive(Debug, Clone, PartialEq, Eq)]
2 pub struct HookEntrySummary {
3 pub event_label: String,
4 pub label: String,
5 pub background: bool,
6 pub honors_background: bool,
7 pub timeout_display: String,
8 pub condition_summary: Option<String>,
9 pub command_preview: String,
10 }
11
12 #[derive(Debug, Clone, PartialEq, Eq, Default)]
13 pub struct HooksListSnapshot {
14 pub enabled: bool,
15 pub hooks: Vec<HookEntrySummary>,
16 pub problem_summaries: Vec<String>,
17 }
18
19 #[derive(Debug, Clone, PartialEq, Eq)]
20 pub struct ProjectHooksReview {
21 pub digest: String,
22 pub sanitized_contents: String,
23 }
24
25 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
26 pub enum HooksAction {
27 OpenExtensionsTab,
28 EditProjectHooks,
29 }
30
31 pub trait CommandHooksContext {
32 fn list_hooks(&self) -> HooksListSnapshot;
33 fn review_project_hooks(&self) -> Result<ProjectHooksReview, String>;
34 fn approve_project_hooks(&mut self, digest: &str) -> Result<(), String>;
35 fn revoke_project_hooks(&mut self) -> Result<(), String>;
36 }
37
37 lines RUST