scm: support --eval
With the ~--eval~ option you can evaluate an expression in mu/scm environment. For example: $ mu scm --eval \ '(format #t "found ~d match(es)\n" (length (mfind "hello")))' found 7173 match(es) Add command-line parameter and implement.
This commit is contained in:
@ -63,7 +63,8 @@ namespace Mu::Scm {
|
||||
* based on the configuration.
|
||||
*
|
||||
* @param store a Store object
|
||||
* @param opts options; opts.scm.script_path must set
|
||||
* @param opts options
|
||||
* @param a path to the script
|
||||
*
|
||||
* @return Ok() or some error
|
||||
*/
|
||||
@ -71,6 +72,22 @@ namespace Mu::Scm {
|
||||
const std::string& script_path);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Evaluate a Guile/SCM expression
|
||||
*
|
||||
* Initialize the Scm sub-system, then start evaluate some expression
|
||||
* based on the configuration.
|
||||
*
|
||||
* @param store a Store object
|
||||
* @param opts options
|
||||
* @param expr some expression to evaluate
|
||||
*
|
||||
* @return Ok() or some error
|
||||
*/
|
||||
Result<void> run_eval(const Mu::Store& store, const Mu::Options& opts,
|
||||
const std::string& expr);
|
||||
|
||||
/**
|
||||
* Helpers
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user