construct: Add -silent option to also suppress console result output.
This commit is contained in:
parent
5ed2e64b62
commit
14b9c51a06
|
@ -84,6 +84,9 @@ construct::console::quit_when_done;
|
||||||
decltype(construct::console::interactive_when_done)
|
decltype(construct::console::interactive_when_done)
|
||||||
construct::console::interactive_when_done;
|
construct::console::interactive_when_done;
|
||||||
|
|
||||||
|
decltype(construct::console::silent)
|
||||||
|
construct::console::silent;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
construct::console::spawn()
|
construct::console::spawn()
|
||||||
{
|
{
|
||||||
|
@ -359,7 +362,12 @@ construct::console::handle_line_bymodule()
|
||||||
pbase(), pptr()
|
pbase(), pptr()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setp(pbase(), epptr());
|
||||||
record_append(str);
|
record_append(str);
|
||||||
|
|
||||||
|
if(silent)
|
||||||
|
return 0;
|
||||||
|
|
||||||
std::cout << str;
|
std::cout << str;
|
||||||
wrote += size(str);
|
wrote += size(str);
|
||||||
if(wrote >= size_t(ratelimit_bytes))
|
if(wrote >= size_t(ratelimit_bytes))
|
||||||
|
@ -369,7 +377,6 @@ construct::console::handle_line_bymodule()
|
||||||
wrote = 0;
|
wrote = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
setp(pbase(), epptr());
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,7 +419,7 @@ construct::console::handle_line_bymodule()
|
||||||
view(out, outbuf)
|
view(out, outbuf)
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!endswith(str, '\n'))
|
if(!endswith(str, '\n') && !silent)
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -22,6 +22,7 @@ struct construct::console
|
||||||
static std::deque<std::string> queue;
|
static std::deque<std::string> queue;
|
||||||
static bool quit_when_done;
|
static bool quit_when_done;
|
||||||
static bool interactive_when_done;
|
static bool interactive_when_done;
|
||||||
|
static bool silent;
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
std::string record_path;
|
std::string record_path;
|
||||||
|
|
|
@ -49,6 +49,7 @@ bool defaults;
|
||||||
const char *bootstrap;
|
const char *bootstrap;
|
||||||
const char *diagnostic;
|
const char *diagnostic;
|
||||||
bool nobanner;
|
bool nobanner;
|
||||||
|
bool silentmode;
|
||||||
|
|
||||||
lgetopt opts[]
|
lgetopt opts[]
|
||||||
{
|
{
|
||||||
|
@ -85,6 +86,7 @@ lgetopt opts[]
|
||||||
{ "bootstrap", &bootstrap, lgetopt::STRING, "Bootstrap fresh database from event vector" },
|
{ "bootstrap", &bootstrap, lgetopt::STRING, "Bootstrap fresh database from event vector" },
|
||||||
{ "diagnostic", &diagnostic, lgetopt::STRING, "Specify a diagnostic type in conjunction with other commands" },
|
{ "diagnostic", &diagnostic, lgetopt::STRING, "Specify a diagnostic type in conjunction with other commands" },
|
||||||
{ "nobanner", &nobanner, lgetopt::BOOL, "Terminal log enabled only in runlevel RUN" },
|
{ "nobanner", &nobanner, lgetopt::BOOL, "Terminal log enabled only in runlevel RUN" },
|
||||||
|
{ "silent", &silentmode, lgetopt::BOOL, "Like quiet mode without console output either" },
|
||||||
{ nullptr, nullptr, lgetopt::STRING, nullptr },
|
{ nullptr, nullptr, lgetopt::STRING, nullptr },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -629,8 +631,11 @@ applyargs()
|
||||||
if(soft_assert)
|
if(soft_assert)
|
||||||
ircd::soft_assert.set("true");
|
ircd::soft_assert.set("true");
|
||||||
|
|
||||||
if(quietmode || nobanner)
|
if(quietmode || nobanner || silentmode)
|
||||||
ircd::log::console_disable();
|
ircd::log::console_disable();
|
||||||
|
|
||||||
|
if(silentmode)
|
||||||
|
construct::console::silent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue