lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a simple way to test for command line options?


From: David Zelinsky
Subject: Re: Is there a simple way to test for command line options?
Date: Tue, 10 Jan 2023 10:01:38 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Kevin Cole <dc.loco@gmail.com> writes:

> On Mon, Jan 9, 2023 at 7:07 PM Hans Aikema <hans.aikema@aikebah.net> wrote:
>
>> On 10 Jan 2023, at 00:01, Kevin Cole <dc.loco@gmail.com> wrote:
>>
>> Is there a way, within a .ly file to conditionally include sections
>> based on command line options?
>>
>> Specifically, I would like to have \paper settings go one way for
>> "lilypond --pdf" and another way for "lilypond --svg".
>>
>>
>> Kevin,
>>
>> don't know of a way with inspecting commandline options, but if
>> environment variables will do for your case: I have the following pattern
>> in use to switch between two page layouts that mainly differ in the \paper
>> block
>>
>> myLayout = #(string-append "layout/" (getenv "MY_BASE") 
>> "PageSetup.ily")\include \myLayout
>>
>>
> Not quite what I was hoping for, but, yes, thanks. I believe I can make
> that work reasonably nicely for me. (I can use the environment variable in
> a shell script to choose the CLI options as well as in the wee bit you
> included, effectively achieving the same thing.)


Just an observation that you can set an environment variable for a
particular command on the command line, by preceding the command with
it:

%  MY_BASE=something lilypond file.ly

That will set MY_BASE to "something" in the environment of the lilypond
process.  Still not what you were asking for, but maybe simpler than
using a shell script, and not much different from using a command
option.

-David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]