On 2024-01-16 10:12 am, Benjamin Bruce wrote:
Is there a way to compile multiple input files into one output file via
the command line? Currently I am using \include, but I would like to be
able to choose the included file on the fly without editing the main
file.
If I recall correctly, LilyPond will process each source file included
on the command-line individually. You could use the shell to
concatenate all your sources together and pass them via standard input.
(Pass the filename "-" to LilyPond to instruct it to read from STDIN.)
Another thought I had was maybe there is a way to pass a value to the
.ly file via the command line and use Scheme to choose the appropriate
file to import based on that value. But that may be even more
far-fetched.
You could do this, but my Spidey-Senseā¢ tingles and suggests this may be
an XY problem. But I simply do not have enough information about what
you are needing to accomplish.
But for reference:
lilypond -e '(define-public a 42)'
Then within your .ly source, you'll need to bring in the guile-user
module:
%%%%
#(use-modules (guile-user))
%% The variable `a` should now be in scope.
%%%%
----
NOTE: All of the above is documented in the first sections of the Usage
manual.
https://lilypond.org/doc/v2.24/Documentation/usage/command_002dline-usage
-- Aaron Hill