mu-scm: add options, some tweaks

Add the (options) procedure + docs.

Some internal tweaks / clean-ups.
This commit is contained in:
Dirk-Jan C. Binnema
2025-06-20 20:31:32 +03:00
parent e647ca924d
commit 812d78be49
7 changed files with 74 additions and 30 deletions

View File

@ -37,26 +37,30 @@ static SCM mu_mod; // The mu module
}
/**
* Create a plist for the relevant configuration items
* Create a plist for the relevant option items
*
* @param opts
*/
static void
init_config (const Options& opts)
init_options(const Options& opts)
{
scm_c_define("options",
alist_add(
SCM_EOL,
make_symbol("mu-home"), opts.muhome,
make_symbol("verbose"), opts.verbose,
make_symbol("debug"), opts.debug,
make_symbol("quiet"), opts.quiet));
SCM scm_opts = alist_add(SCM_EOL,
make_symbol("verbose"), opts.verbose,
make_symbol("debug"), opts.debug,
make_symbol("quiet"), opts.quiet);
if (opts.muhome.empty())
scm_opts = alist_add(scm_opts, make_symbol("mu-home"), SCM_BOOL_F);
else
scm_opts = alist_add(scm_opts, make_symbol("mu-home"), opts.muhome);
scm_c_define("%options", scm_opts);
}
static void
init_module_mu(void* _data)
{
init_config(config->options);
init_options(config->options);
init_store(config->store);
}
@ -83,7 +87,6 @@ static std::string mu_scm_path;
static std::string mu_scm_shell_path;
}
static Result<void>
prepare_run(const Mu::Scm::Config& conf)
{