semf
command.cpp
Go to the documentation of this file.
1
12
13namespace semf::esh
14{
15Command::Command(std::string_view name, std::string_view help, SlotBase<int, char**, Printer&, int&>& callback, Shell& esh)
16: Command(name, help, esh)
17{
18 command.connect(callback);
19}
20
21Command::Command(std::string_view name, std::string_view help, Shell& esh)
22: Command(name, help)
23{
24 esh.addCommand(*this);
25}
26
27Command::Command(std::string_view name, std::string_view help)
28: m_name(name),
29 m_help(help)
30{}
31
32std::string_view Command::name() const
33{
34 return m_name;
35}
36
37std::string_view Command::help() const
38{
39 return m_help;
40}
41} // namespace semf::esh
Base Class for all Slot implementations.
Definition: slotbase.h:25
Wrapper class for shell command. The user has to create object of this class for adding their functio...
Definition: command.h:28
Command(std::string_view name, std::string_view help, SlotBase< int, char **, Printer &, int & > &callback, Shell &esh)
Constructor. Adds the command to its shell.
Definition: command.cpp:15
std::string_view name() const
Returns the command's name.
Definition: command.cpp:32
std::string_view help() const
Returns the command's help text.
Definition: command.cpp:37
This class manages a semf's embedded shell (esh) operating on a single UART. The esh can be used for ...
Definition: shell.h:34
void addCommand(Command &cmd)
Adds a command to the shell.
Definition: shell.cpp:34