mu: add 'scm' command

Add the "scm" command, the way to get a Guile/Scheme shell.

This is experimental but will replace the current guile support in guile/ at
some point.
This commit is contained in:
Dirk-Jan C. Binnema
2025-05-31 12:41:37 +03:00
parent 7f274fe518
commit f9c24c7166
6 changed files with 73 additions and 6 deletions

View File

@ -35,6 +35,10 @@
#include "message/mu-message.hh"
#include "message/mu-mime-object.hh"
#if BUILD_GUILE
#include "scm/mu-scm.hh"
#endif/*BUILD_GUILE*/
#include "utils/mu-error.hh"
#include "utils/mu-utils-file.hh"
#include "utils/mu-utils.hh"
@ -43,7 +47,6 @@
using namespace Mu;
static Result<void>
cmd_fields(const Options& opts)
{
@ -63,6 +66,17 @@ cmd_find(const Options& opts)
return mu_cmd_find(*store, opts);
}
static Result<void>
cmd_scm(const Store& store, const Options& opts)
{
#if !BUILD_SCM
return Err(Error::Code::InvalidArgument,
"scm/guile is not available in this build");
#else
return Mu::Scm::run(Mu::Scm::Config{store, opts});
#endif /*BUILD_SCM*/
}
static void
show_usage(void)
@ -133,6 +147,9 @@ Mu::mu_cmd_execute(const Options& opts) try {
return cmd_find(opts);
case Options::SubCommand::Info:
return with_readonly_store(mu_cmd_info, opts);
case Options::SubCommand::Scm:
return with_readonly_store(cmd_scm, opts);
/* writable store */