[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Including input files via command line
From: |
Benjamin Bruce |
Subject: |
Re: Including input files via command line |
Date: |
Tue, 16 Jan 2024 13:12:35 -0600 |
User-agent: |
Cyrus-JMAP/3.9.0-alpha0-1374-gc37f3abe3d-fm-20240102.001-gc37f3abe |
Actually the second solution (passing a variable via Scheme) works great!
Basically I have multiple template files to render a score in different ways
(paper sizes, etc) and this way I can use the same base file to generate PDFs
using the different templates without editing the base file every time.
And you're right--I did go over that page in the manual, but that part must
have escaped me. Thanks for your help.
Benjamin
๐ช๐ฏ 2024-01-16 ๐จ๐ 12:39, Aaron Hill <lilypond@hillvisions.com> ๐ฎ๐ด๐:
> 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