teditor  1.8.0@@fee5e94
Terminal based editor written in C++
Namespaces | Functions
watch/ops.cpp File Reference
#include "core/editor.h"
#include "core/command.h"
#include "mode.h"
#include "core/utils.h"

Namespaces

 teditor
 
 teditor::watch
 
 teditor::watch::ops
 

Functions

Buffer & teditor::watch::ops::getWatchBuff (Editor &ed)
 
 teditor::watch::ops::DEF_CMD (Watch, "watch", "ledger_ops", DEF_OP() { auto cmd=ed.prompt("Command to watch: ");if(cmd.empty()) return;CMBAR_MSG(ed, "Starting watch on '%s'...\n", cmd.c_str());auto &buf=getWatchBuff(ed);ed.switchToBuff("*watch");auto *mode=buf.getMode< watch::WatchMode >("watch");mode->start(&buf, cmd);})
 
 teditor::watch::ops::DEF_CMD (WatchSleep, "watch-sleep", "ledger_ops", DEF_OP() { auto cmd=ed.prompt("Command to watch: ");if(cmd.empty()) return;auto sleep=ed.prompt("Sleep time (in ms) between retries: ");if(sleep.empty()) return;CMBAR_MSG(ed, "Starting watch on '%s' with sleep-time=%s ms...\n", cmd.c_str(), sleep.c_str());auto &buf=getWatchBuff(ed);ed.switchToBuff("*watch");auto *mode=buf.getMode< watch::WatchMode >("watch");mode->start(&buf, cmd, str2num(sleep));})
 
 teditor::watch::ops::DEF_CMD (WatchStop, "watch::stop", "ledger_ops", DEF_OP() { CMBAR_MSG(ed, "Waiting for previously running command to complete...\n");auto &buf=getWatchBuff(ed);ed.switchToBuff("*watch");auto *mode=buf.getMode< watch::WatchMode >("watch");mode->stop();CMBAR_MSG(ed, "Watch command stopped successfully\n");})
 
 teditor::watch::ops::DEF_CMD (WatchRestart, "watch::restart", "ledger_ops", DEF_OP() { CMBAR_MSG(ed, "Restarting the watch command...\n");auto &buf=getWatchBuff(ed);ed.switchToBuff("*watch");auto *mode=buf.getMode< watch::WatchMode >("watch");mode->restart();CMBAR_MSG(ed, "Watch command restarted successfully\n");})