aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorAlexander Blair <snipa@jagtech.io>2020-08-16 12:44:03 -0700
committerAlexander Blair <snipa@jagtech.io>2020-08-16 12:44:03 -0700
commitc6c4ead44ee7ecd1959a940564c3fd5c96cf1ba5 (patch)
treeb2317e82ad6ddc071b70f4509e695546e74f4269 /contrib
parentMerge pull request #6603 (diff)
parentWallet, daemon: From 'help_advanced' back to 'help', and new 'apropos' command (diff)
downloadmonero-c6c4ead44ee7ecd1959a940564c3fd5c96cf1ba5.tar.xz
Merge pull request #6614
fb31167b1 Wallet, daemon: From 'help_advanced' back to 'help', and new 'apropos' command (rbrunner7)
Diffstat (limited to 'contrib')
-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];