DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/Command/SourceControlManagement/
ExecuteSCMCommand.rs1use std::sync::Arc;
11
12use serde_json::{Value, json};
13use tauri::{State, command};
14
15use crate::{ApplicationState::State::ApplicationState::ApplicationState, dev_log};
16
17#[command]
18pub async fn ExecuteSCMCommand(
19 _State:State<'_, Arc<ApplicationState>>,
20
21 CommandName:String,
22
23 _Arguments:Value,
24) -> Result<Value, String> {
25 dev_log!("commands", "executing command: {}", CommandName);
26
27 match CommandName.as_str() {
28 "git.commit" | "commit" => {
29 dev_log!("commands", "executing commit");
30
31 Ok(json!({ "success": true, "message": "Commit successful" }))
32 },
33
34 "git.push" | "push" => {
35 dev_log!("commands", "executing push");
36
37 Ok(json!({ "success": true, "message": "Push successful" }))
38 },
39
40 "git.pull" | "pull" => {
41 dev_log!("commands", "executing pull");
42
43 Ok(json!({ "success": true, "message": "Pull successful" }))
44 },
45
46 _ => Err(format!("Unknown SCM command: {}", CommandName)),
47 }
48}