DYTSrouce/src/workspace/CommandExecutor.h
2025-10-13 08:20:53 +08:00

32 lines
876 B
C++

#pragma once
#include <QString>
#include <QStringList>
#include <QMap>
#include "workspace/WorkSpace.h"
// Merge Command model into this header to reduce files
struct Command {
QString name;
QString program;
QStringList args; // final argument list to pass to QProcess
QString rawArgs; // original args string from XML (optional)
QString path; // script or executable path
QString workingDir; // working directory
bool enabled{true};
QMap<QString, QString> env; // environment key/value pairs
QString descript; // description
int timeoutMs{30000}; // default 30s
};
class CommandExecutor {
public:
explicit CommandExecutor(const Command& cmd) : cmd_(cmd) {}
void Execute(WorkSpace* ws, WorkSpace::CommandWhen when);
const Command& Get() const { return cmd_; }
private:
Command cmd_;
};