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: Timothy Lanfear
Subject: Re: Is there a simple way to test for command line options?
Date: Tue, 10 Jan 2023 18:11:41 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 09/01/2023 23:00, Kevin Cole 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".

The function ly:command-line-options returns a string with all the -d options. The backend option is set to svg when when generating svg output and absent by default.

\version "2.22.0"

#(let* ((options (ly:command-line-options))
        (svg     (string-contains options "(backend . svg)")))
  (if (integer? svg) (ly:message "svg") (ly:message "not svg")))

{
  c''1
}

-- 
Timothy Lanfear, Bristol, UK.

reply via email to

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