Skip to content

Commit 6efdbfd

Browse files
authored
Merge pull request #30 from Jeamee/feat/cmd-arg-support
Feat/cmd arg support
2 parents cd4b89e + 94112bf commit 6efdbfd

File tree

6 files changed

+18
-6
lines changed

6 files changed

+18
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mcphub-desktop",
33
"private": true,
4-
"version": "0.2.0",
4+
"version": "0.2.1",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

src-tauri/Cargo.lock

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mcphub-desktop"
3-
version = "0.1.0"
3+
version = "0.2.1"
44
description = "A Tauri App"
55
authors = ["you"]
66
edition = "2021"
@@ -27,6 +27,7 @@ log = "0.4.22"
2727
glob = "0.3.1"
2828
home = "0.5.9"
2929
anyhow = "1.0.93"
30+
shell-escape = "0.1.5"
3031
tempfile = "3.8.1"
3132
xshell = "0.2.7"
3233
reqwest = { version = "0.11", features = ["blocking", "json"] }

src-tauri/src/api/servers/core.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
use crate::utils::os::get_home;
2+
use std::borrow::Cow;
23
use crate::APP_STATE_FILENAME;
34
use log::{debug, error};
45
use serde::{Deserialize, Serialize};
56
use std::collections::HashMap;
67
use tauri_plugin_store::StoreExt;
8+
use shell_escape::escape;
79

810
#[derive(Debug, Serialize, Deserialize)]
911
struct BaseServer {
@@ -246,7 +248,7 @@ pub async fn install_server_function(
246248
let env = env.unwrap_or_else(|| server.command_info.env.clone());
247249
if input_arg.is_some() {
248250
input_arg_config.value = input_arg.unwrap();
249-
arg_configs = format!("{} {}", arg_configs, input_arg_config.value.join(" "));
251+
arg_configs = format!("{} {}", arg_configs, escape(Cow::from(input_arg_config.value.join(" "))));
250252
}
251253

252254
let mut config = ClientConfig::load();

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "mcphub-desktop",
4-
"version": "0.2.0",
4+
"version": "0.2.1",
55
"identifier": "com.mcphub-desktop.app",
66
"build": {
77
"beforeDevCommand": "pnpm dev",

src/components/ConfigModal.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ export function ConfigModal({ isOpen, onClose, env, guide, inputArg, onSave }: C
5959
onSave(config, argValues)
6060
onClose()
6161
}
62+
console.log(argValues)
63+
console.log(inputArg)
6264

6365
return (
6466
<Dialog open={isOpen} onOpenChange={onClose}>
@@ -113,7 +115,7 @@ export function ConfigModal({ isOpen, onClose, env, guide, inputArg, onSave }: C
113115
{inputArg.name}
114116
</Label>
115117

116-
{argValues.map((value, index) => (
118+
{(argValues.length > 0 ? argValues : [""]).map((value, index) => (
117119
<div key={index} className="flex gap-2">
118120
{inputArg.class === "Text" ? (
119121
<Input

0 commit comments

Comments
 (0)