35#ifndef COMMAND_BANK_UTILS_H_
36#define COMMAND_BANK_UTILS_H_
41#include "CommandBank.h"
42#include "CommandSections.h"
43#include "drain/image/Image.h"
72 Context & ctx = getContext<Context>();
73 ctx.log.setVerbosity(value);
76 drain::getLog().setVerbosity(value);
77 drain::image::getImgLog().setVerbosity(value-1);
92 Context & ctx = getContext<Context>();
93 ctx.log.setVerbosity(LOG_DEBUG);
94 drain::getLog().setVerbosity(LOG_DEBUG);
95 drain::image::getImgLog().setVerbosity(LOG_DEBUG);
108 void exec()
const override;
139 std::string filename;
181 ctx.expandVariables = !ctx.expandVariables;
238 void exec()
const override;
266 cmd_section_type TRIGGER = drain::Static::get<drain::TriggerSection>().index;
275 mout.
debug(
"Storing script with '" ,
getName() ,
"' ." );
319 if (cmdBank.
has(
"general")){
320 cmdBank.
help(
"general");
359template <
class C=Context>
376 C &ctx = getContext<C>();
382 ifstr.open(value.c_str(), std::ios::in);
384 std::stringstream sstr;
385 sstr << ifstr.rdbuf();
393 ctx.formatStr = sstr.str();
397 mout.
error(getName() ,
": opening file '" , value ,
"' failed." );
416 Context & ctx = getContext<>();
420 mout.
error(
"Command '" , value ,
"' not found." );
bool has(const K &key) const
Check if a cloner is defined for this key.
Definition Bank.h:140
Simple implementation of Command: adds name , description and parameters .
Definition Command.h:461
const std::string & getName() const final
Returns the command name.
Definition Command.h:384
Definition CommandBankUtils.h:82
void exec() const
Run the command with current parameter values.
Definition CommandBankUtils.h:91
Load script file and execute the commands immediately using current Context.
Definition CommandBankUtils.h:289
Executes the defined script.
Definition CommandBankUtils.h:258
void exec() const
Run the command with current parameter values.
Definition CommandBankUtils.h:272
Definition CommandBankUtils.h:170
void exec() const
Run the command with current parameter values.
Definition CommandBankUtils.h:179
Definition CommandBankUtils.h:101
void exec() const override
Run the command with current parameter values.
Definition CommandBankUtils.cpp:112
CommandBank-dependent.
Definition CommandBankUtils.h:308
void exec() const
Run the command with current parameter values.
Definition CommandBankUtils.h:317
Definition CommandBankUtils.h:125
void exec() const
Run the command with current parameter values.
Definition CommandBankUtils.cpp:52
Special command for handling undefined commands.
Definition CommandBankUtils.h:403
void exec() const
Run the command with current parameter values.
Definition CommandBankUtils.h:415
Define a script.
Definition CommandBankUtils.h:220
void exec() const override
Run the command with current parameter values.
Definition CommandBankUtils.cpp:148
Define a script.
Definition CommandBankUtils.h:192
Definition CommandBankUtils.h:152
void exec() const
Run the command with current parameter values.
Definition CommandBankUtils.cpp:73
Definition CommandBankUtils.h:61
void exec() const
Run the command with current parameter values.
Definition CommandBankUtils.h:70
Container and execution tools for commands derived from Command.
Definition CommandBank.h:67
std::string notFoundHandlerCmdKey
If defined, the command - key not getName() - to which all unresolved commands are directed.
Definition CommandBank.h:278
std::string execFileCmd
Command for reading and executing commands from a file in the current (running) context.
Definition CommandBank.h:321
void help(std::ostream &ostr=std::cout)
Basic help dump, displays help commands to proceed.
Definition CommandBank.cpp:949
std::string scriptCmd
Command for storing a routine.
Definition CommandBank.h:290
int cmd_section_type
Definition Command.h:187
cmd_section_type section
Section bitmask; zero means hidden from help.
Definition Command.h:188
std::string formatStr
Definition Context.h:214
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition Log.h:326
Logger & debug(const TT &... args)
Debug information.
Definition Log.h:676
Logger & error(const TT &... args)
Echoes.
Definition Log.h:426
A single-parameter command.
Definition Command.h:487