mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 15:01:49 +00:00
add '--stdin-cmd' command line flag
This commit is contained in:
parent
7c0772b5b6
commit
b200d38e48
4 changed files with 10 additions and 2 deletions
|
|
@ -13,6 +13,8 @@ static std::thread reader_thread;
|
||||||
|
|
||||||
void start_stdin_reader(cmd::CommandsInterpreter& interpreter) {
|
void start_stdin_reader(cmd::CommandsInterpreter& interpreter) {
|
||||||
reader_thread = std::thread([&interpreter]() {
|
reader_thread = std::thread([&interpreter]() {
|
||||||
|
logger.info() << "reader thread started";
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
while (std::getline(std::cin, line)) {
|
while (std::getline(std::cin, line)) {
|
||||||
if (line.empty()) {
|
if (line.empty()) {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
struct CoreParameters {
|
struct CoreParameters {
|
||||||
bool headless = false;
|
bool headless = false;
|
||||||
bool testMode = false;
|
bool testMode = false;
|
||||||
|
bool stdinCommands = false;
|
||||||
std::filesystem::path resFolder = "res";
|
std::filesystem::path resFolder = "res";
|
||||||
std::filesystem::path userFolder = ".";
|
std::filesystem::path userFolder = ".";
|
||||||
std::filesystem::path scriptFile;
|
std::filesystem::path scriptFile;
|
||||||
|
|
|
||||||
|
|
@ -192,8 +192,9 @@ void Engine::initialize(CoreParameters coreParameters) {
|
||||||
if (!params.headless) {
|
if (!params.headless) {
|
||||||
project->loadProjectClientScript();
|
project->loadProjectClientScript();
|
||||||
}
|
}
|
||||||
|
if (params.stdinCommands) {
|
||||||
start_stdin_reader(*cmd);
|
start_stdin_reader(*cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::loadSettings() {
|
void Engine::loadSettings() {
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,10 @@ static bool perform_keyword(
|
||||||
params.headless = true;
|
params.headless = true;
|
||||||
return true;
|
return true;
|
||||||
}, "", "run in headless mode."),
|
}, "", "run in headless mode."),
|
||||||
|
ArgC("--stdin-cmd", [¶ms]() -> bool {
|
||||||
|
params.stdinCommands = true;
|
||||||
|
return true;
|
||||||
|
}, "", "run commands from stdin."),
|
||||||
ArgC("--tps", [¶ms, &reader]() -> bool {
|
ArgC("--tps", [¶ms, &reader]() -> bool {
|
||||||
params.tps = reader.nextInt();
|
params.tps = reader.nextInt();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue