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:
Dirk-Jan C. Binnema
2026-03-07 12:20:35 +02:00
committed by Seth Ladygo
parent cad39e0ff1
commit 6dca68b989
6 changed files with 54 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2022-2025 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** Copyright (C) 2022-2026 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
@ -261,6 +261,7 @@ struct Options {
bool listen; /**< Whether to start listening on a socket */
Option<std::string> socket_path; /**< path for the '--listen'
* Unix domain socket */
Option<std::string> eval; /**< expression to evaluate */
} scm;