Adds setting and flag to enable Lilypond's point and click
This commit is contained in:
parent
971fcd2fd8
commit
99a8e7042a
@ -20,6 +20,7 @@ import (
|
||||
)
|
||||
|
||||
var keepTemplate bool
|
||||
var enablePointAndClick bool
|
||||
|
||||
// bookCmd represents the book command
|
||||
var bookCmd = &cobra.Command{
|
||||
@ -29,6 +30,7 @@ var bookCmd = &cobra.Command{
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
path, opts := getSettings()
|
||||
opts.KeepBookTemplate = opts.KeepBookTemplate || keepTemplate
|
||||
opts.EnablePointAndClick = opts.EnablePointAndClick || enablePointAndClick
|
||||
compiler.MakeBook(path, opts)
|
||||
},
|
||||
}
|
||||
@ -36,5 +38,7 @@ var bookCmd = &cobra.Command{
|
||||
func init() {
|
||||
bookCmd.Flags().BoolVarP(&keepTemplate, "keep-template",
|
||||
"k", false, "Leave the LaTeX source for the book in the output directory")
|
||||
bookCmd.Flags().BoolVarP(&enablePointAndClick, "clickable",
|
||||
"c", false, "Enable Lilypond's Point and Click functionality")
|
||||
RootCmd.AddCommand(bookCmd)
|
||||
}
|
||||
|
@ -29,10 +29,13 @@ Files that have already been compiled will be skipped,
|
||||
unless the lilypond file has been edited.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
path, opts := getSettings()
|
||||
opts.EnablePointAndClick = opts.EnablePointAndClick || enablePointAndClick
|
||||
compiler.CompileDir(path, opts)
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
compileCmd.Flags().BoolVarP(&enablePointAndClick, "clickable",
|
||||
"c", false, "Enable Lilypond's Point and Click functionality")
|
||||
RootCmd.AddCommand(compileCmd)
|
||||
}
|
||||
|
@ -37,6 +37,9 @@ func PrepareLilypond(opts *settings.Settings) {
|
||||
}
|
||||
lilypondArgs = append(lilypondArgs, "--loglevel=ERROR")
|
||||
lilypondArgs = append(lilypondArgs, "--pdf")
|
||||
if !opts.EnablePointAndClick {
|
||||
lilypondArgs = append(lilypondArgs, "-dno-point-and-click")
|
||||
}
|
||||
}
|
||||
|
||||
// Lilypond runs the lilypond compiler on the given path
|
||||
|
@ -40,6 +40,7 @@ type Settings struct {
|
||||
KeepBookTemplate bool // Leave the LaTeX source for the book in the output directory
|
||||
FlatOutputDir bool // Keep all output file in a flat output directory
|
||||
DefaultCategories []string // Categories included in the book by default
|
||||
EnablePointAndClick bool // Enable Lilypond's Point and Click functionality
|
||||
}
|
||||
|
||||
// FromFile reads a settings file in json format and returns the Settings struct
|
||||
|
Reference in New Issue
Block a user