19 #include <uuid/console.h>
47 : shell_(shell), begin_(begin), end_(end) {
65 : shell_(std::move(shell)), begin_(begin), command_(command), end_(end) {
70 if (command_ !=
end_) {
71 available_command_ = std::make_shared<AvailableCommand>(command_->second);
73 available_command_.reset();
80 }
while (command_ !=
end_ && !
shell_.
has_flags(command_->second.flags_, command_->second.not_flags_));
89 }
while (command_ !=
begin_ && !
shell_.
has_flags(command_->second.flags_, command_->second.not_flags_));
void update()
Update the available command from the current command iterator.
Base class for a command shell.
const_iterator & operator--()
Pre-decrement the current iterator to the previous available command.
std::multimap< unsigned int, Command >::const_iterator command_iterator
const flash_string_vector name_
const Commands::Command & command_
const_iterator(const Shell &shell, const command_iterator &begin, const command_iterator &command, const command_iterator &end)
Create an iterator describing an available command in a shell with the current flags.
AvailableCommand(const Command &command)
Construct a new command that is available for execution on a Shell.
Available commands in the shell's context with the current flags.
unsigned int context() const
Get the context at the top of the stack.
const_iterator cbegin() const
Returns an iterator to the first command.
AvailableCommands(const Shell &shell, const command_iterator &begin, const command_iterator &end)
Create an iterable object describing available commands in a shell with the current flags.
const_iterator cend() const
Returns an iterator to the element following the last command.
Command for execution on a Shell.
const flash_string_vector arguments_
bool has_flags(unsigned int flags, unsigned int not_flags=0) const
Check if the current flags include all of the specified flags and none of the specified not_flags.
std::string read_flash_string(const __FlashStringHelper *flash_str)
Read a string from flash and convert it to a std::string.
Iterator of available commands for execution on a Shell.
std::vector< std::string > name_
std::vector< std::string > arguments_
AvailableCommands available_commands(const Shell &shell) const
Get the available commands in the current context and with the current flags.
std::multimap< unsigned int, Command > commands_
const_iterator & operator++()
Pre-increment the current iterator to the next available command.