A small application to manage Lilypond music repositories
at main 46 lines 1.7 kB view raw
1// Copyright © 2016 Jip J. Dekker <jip@dekker.li> 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15package cmd 16 17import ( 18 "github.com/jjdekker/ponder/compiler" 19 "github.com/spf13/cobra" 20) 21 22var keepTemplate bool 23var enablePointAndClick bool 24 25// bookCmd represents the book command 26var bookCmd = &cobra.Command{ 27 Use: "book", 28 Short: "Generate target songbook", 29 Long: `Generates a songbook based on a target specified in the ponder 30settings. If not all songs included in the target have been compiled, 31these songs will be compiled as if the compile command had been called.`, 32 Run: func(cmd *cobra.Command, args []string) { 33 path, opts := getSettings() 34 opts.KeepBookTemplate = opts.KeepBookTemplate || keepTemplate 35 opts.EnablePointAndClick = opts.EnablePointAndClick || enablePointAndClick 36 compiler.MakeBook(path, opts) 37 }, 38} 39 40func init() { 41 bookCmd.Flags().BoolVarP(&keepTemplate, "keep-template", 42 "k", false, "Leave the LaTeX source for the book in the output directory") 43 bookCmd.Flags().BoolVarP(&enablePointAndClick, "clickable", 44 "c", false, "Enable Lilypond's Point and Click functionality") 45 RootCmd.AddCommand(bookCmd) 46}