aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/include/console_handler.h
diff options
context:
space:
mode:
authorrbrunner7 <rbrunner@dreamshare.ch>2020-06-01 10:20:59 +0200
committerrbrunner7 <rbrunner@dreamshare.ch>2020-07-24 07:12:11 +0200
commitfb31167b12caccdac071bdbe5ad58f235cdb82fe (patch)
treef4ccd86e7fe5347ce8e9e21a36bdba2d976d2414 /contrib/epee/include/console_handler.h
parentMerge pull request #6586 (diff)
downloadmonero-fb31167b12caccdac071bdbe5ad58f235cdb82fe.tar.xz
Wallet, daemon: From 'help_advanced' back to 'help', and new 'apropos' command
Diffstat (limited to '')
-rw-r--r--contrib/epee/include/console_handler.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/contrib/epee/include/console_handler.h b/contrib/epee/include/console_handler.h
index 08d9b8802..219b593b0 100644
--- a/contrib/epee/include/console_handler.h
+++ b/contrib/epee/include/console_handler.h
@@ -543,6 +543,31 @@ eof:
return it->second.second;
}
+ std::vector<std::string> get_command_list(const std::vector<std::string>& keywords = std::vector<std::string>())
+ {
+ std::vector<std::string> list;
+ list.reserve(m_command_handlers.size());
+ for(auto const& x:m_command_handlers)
+ {
+ bool take = true;
+ for(auto const& y:keywords)
+ {
+ bool in_usage = x.second.second.first.find(y) != std::string::npos;
+ bool in_description = x.second.second.second.find(y) != std::string::npos;
+ if (!(in_usage || in_description))
+ {
+ take = false;
+ break;
+ }
+ }
+ if (take)
+ {
+ list.push_back(x.first);
+ }
+ }
+ return list;
+ }
+
void set_handler(const std::string& cmd, const callback& hndlr, const std::string& usage = "", const std::string& description = "")
{
lookup::mapped_type & vt = m_command_handlers[cmd];