mu/cmd: update for new sexp API

Makes the code a bit cleaner.
This commit is contained in:
Dirk-Jan C. Binnema
2022-11-07 18:36:33 +02:00
parent a417b38624
commit 08ffba42b9
3 changed files with 12 additions and 18 deletions

View File

@ -372,12 +372,10 @@ static bool
output_sexp(const Option<Message>& msg, const OutputInfo& info, const MuConfig* opts, GError** err)
{
if (msg) {
if (const auto sexp{msg->cached_sexp()}; !sexp.empty())
fputs(sexp.c_str(), stdout);
if (const auto sexp{msg->sexp()}; !sexp.empty())
fputs(sexp.to_string().c_str(), stdout);
else
fputs(msg->to_sexp().to_sexp_string().c_str(), stdout);
fputs(msg->sexp().to_string().c_str(), stdout);
fputs("\n", stdout);
}
@ -401,7 +399,7 @@ output_json(const Option<Message>& msg, const OutputInfo& info, const MuConfig*
return true;
g_print("%s%s\n",
msg->to_sexp().to_json_string().c_str(),
msg->sexp().to_json_string().c_str(),
info.last ? "" : ",");
return true;