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