mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
modules/console: Start a conf cmd; add direct list subcmd for now.
This commit is contained in:
parent
9d69e5a405
commit
977ebd4e47
1 changed files with 41 additions and 0 deletions
|
@ -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__net(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__test(const string_view &line);
|
||||
|
||||
|
@ -62,6 +63,9 @@ try
|
|||
case hash("debuglog"):
|
||||
return console_cmd__debuglog(args);
|
||||
|
||||
case hash("conf"):
|
||||
return console_cmd__conf(args);
|
||||
|
||||
case hash("mod"):
|
||||
return console_cmd__mod(args);
|
||||
|
||||
|
@ -173,6 +177,43 @@ console_id__user(const m::user::id &id,
|
|||
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
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue