From 7cec36d3316b8fc27401a0ccc70732ab4bda3b5e Mon Sep 17 00:00:00 2001 From: lucaspalomodevelop Date: Wed, 28 Jun 2023 12:26:23 +0200 Subject: [PATCH] you can add now terminal arguments to scripts --- src/main.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 75696f2..f3d39e5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,7 +16,7 @@ void input(int argc, char *argv[]) command.addCommand("run", "[script] - Runs a script", runScript); command.addCommand("help", "- Shows this help message", help); command.addCommand("ls", "- Lists all scripts ", listScripts); - // command.addCommand("config", "open configure dialog", removeScript); + // command.addCommand("config", "open configure dialog", removeScript); command.addCommand("add", "[script] - Adds a script", addScript); command.addCommand("new", "[script] - Adds a script", addScript); command.addCommand("edit", "[script] - Edits a script", editScript); @@ -32,8 +32,13 @@ void runScript(int argc, char *argv[]) // std::cout << "Running script: " << argv[1] << std::endl; std::string pre_script = "cd " + dir + " && "; - std::string script = pre_script + dir + "/" + argv[1]; - // std::cout << "Running script: " << script << std::endl; + std::string args = ""; + for (int i = 2; i < argc; i++) + { + args += argv[i]; + args += " "; + } + std::string script = pre_script + dir + "/" + argv[1] + " " + args; system(script.c_str()); }