Skip to content

Commit

Permalink
Merge pull request #30 from Jeamee/feat/cmd-arg-support
Browse files Browse the repository at this point in the history
Feat/cmd arg support
  • Loading branch information
Jeamee authored Dec 28, 2024
2 parents cd4b89e + 94112bf commit 6efdbfd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mcphub-desktop",
"private": true,
"version": "0.2.0",
"version": "0.2.1",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
9 changes: 8 additions & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mcphub-desktop"
version = "0.1.0"
version = "0.2.1"
description = "A Tauri App"
authors = ["you"]
edition = "2021"
Expand All @@ -27,6 +27,7 @@ log = "0.4.22"
glob = "0.3.1"
home = "0.5.9"
anyhow = "1.0.93"
shell-escape = "0.1.5"
tempfile = "3.8.1"
xshell = "0.2.7"
reqwest = { version = "0.11", features = ["blocking", "json"] }
Expand Down
4 changes: 3 additions & 1 deletion src-tauri/src/api/servers/core.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use crate::utils::os::get_home;
use std::borrow::Cow;
use crate::APP_STATE_FILENAME;
use log::{debug, error};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use tauri_plugin_store::StoreExt;
use shell_escape::escape;

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

let mut config = ClientConfig::load();
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "mcphub-desktop",
"version": "0.2.0",
"version": "0.2.1",
"identifier": "com.mcphub-desktop.app",
"build": {
"beforeDevCommand": "pnpm dev",
Expand Down
4 changes: 3 additions & 1 deletion src/components/ConfigModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export function ConfigModal({ isOpen, onClose, env, guide, inputArg, onSave }: C
onSave(config, argValues)
onClose()
}
console.log(argValues)
console.log(inputArg)

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

{argValues.map((value, index) => (
{(argValues.length > 0 ? argValues : [""]).map((value, index) => (
<div key={index} className="flex gap-2">
{inputArg.class === "Text" ? (
<Input
Expand Down

0 comments on commit 6efdbfd

Please sign in to comment.