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