0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 00:32:35 +01:00

modules/console: Start a conf cmd; add direct list subcmd for now.

This commit is contained in:
Jason Volk 2018-03-22 14:44:54 -07:00
parent 9d69e5a405
commit 977ebd4e47

View file

@ -32,6 +32,7 @@ static bool console_cmd__key(const string_view &line);
static bool console_cmd__db(const string_view &line); static bool console_cmd__db(const string_view &line);
static bool console_cmd__net(const string_view &line); static bool console_cmd__net(const string_view &line);
static bool console_cmd__mod(const string_view &line); static bool console_cmd__mod(const string_view &line);
static bool console_cmd__conf(const string_view &line);
static bool console_cmd__debuglog(const string_view &line); static bool console_cmd__debuglog(const string_view &line);
static bool console_cmd__test(const string_view &line); static bool console_cmd__test(const string_view &line);
@ -62,6 +63,9 @@ try
case hash("debuglog"): case hash("debuglog"):
return console_cmd__debuglog(args); return console_cmd__debuglog(args);
case hash("conf"):
return console_cmd__conf(args);
case hash("mod"): case hash("mod"):
return console_cmd__mod(args); return console_cmd__mod(args);
@ -173,6 +177,43 @@ console_id__user(const m::user::id &id,
return true; return true;
} }
//
// conf
//
static bool console_cmd__conf_list(const string_view &line);
bool
console_cmd__conf(const string_view &line)
{
const auto args
{
tokens_after(line, ' ', 0)
};
switch(hash(token(line, ' ', 0, {})))
{
case hash("list"):
return console_cmd__conf_list(args);
default:
return console_cmd__conf_list(line);
}
}
bool
console_cmd__conf_list(const string_view &line)
{
thread_local char val[4_KiB];
for(const auto &item : conf::items)
out
<< std::setw(48) << std::right << item.first
<< " = " << item.second->get(val)
<< std::endl;
return true;
}
// //
// mod // mod
// //