Implemented 'pwd' command to retrieve working directory.

This commit is contained in:
Jakob Friedl
2025-06-20 16:44:39 +02:00
parent b25d09e282
commit 6a92a19b9e
11 changed files with 72 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
import ./[shell, sleep]
export shell, sleep
import ./[shell, sleep, pwd]
export shell, sleep, pwd
#[
"Monarch" Agent commands:

View File

@@ -0,0 +1,19 @@
import nanoid, sequtils, strutils, strformat, terminal, times
import ../../types
proc taskGetWorkingDirectory*(cq: Conquest) =
# Create a new task
let
date: string = now().format("dd-MM-yyyy HH:mm:ss")
task = Task(
id: generate(alphabet=join(toSeq('A'..'Z'), ""), size=8),
agent: cq.interactAgent.name,
command: GetWorkingDirectory,
args: @[],
)
# Add new task to the agent's task queue
cq.interactAgent.tasks.add(task)
cq.writeLine(fgBlack, styleBright, fmt"[{date}] [*] ", resetStyle, "Tasked agent to get current working directory.")