teditor  1.8.0@@fee5e94
Terminal based editor written in C++
Functions
teditor::watch::ops Namespace Reference

Functions

BuffergetWatchBuff (Editor &ed)
 
 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);})
 
 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));})
 
 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");})
 
 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");})
 

Function Documentation

◆ DEF_CMD() [1/4]

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);}   
)

◆ DEF_CMD() [2/4]

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");}   
)

◆ DEF_CMD() [3/4]

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));}   
)

◆ DEF_CMD() [4/4]

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");}   
)

◆ getWatchBuff()

Buffer& teditor::watch::ops::getWatchBuff ( Editor ed)