diff --git a/cmd/book.go b/cmd/book.go index 0f0af32..9e3a8b8 100644 --- a/cmd/book.go +++ b/cmd/book.go @@ -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) } diff --git a/cmd/compile.go b/cmd/compile.go index b911583..ab2defb 100644 --- a/cmd/compile.go +++ b/cmd/compile.go @@ -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) } diff --git a/compiler/lilypond.go b/compiler/lilypond.go index e505777..20a9045 100644 --- a/compiler/lilypond.go +++ b/compiler/lilypond.go @@ -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 diff --git a/settings/settings.go b/settings/settings.go index ac32759..e8e7a48 100644 --- a/settings/settings.go +++ b/settings/settings.go @@ -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