github.com/mutagen-io/mutagen@v0.18.0-rc1/cmd/mutagen-sidecar/legal.go (about) 1 package main 2 3 import ( 4 "fmt" 5 6 "github.com/spf13/cobra" 7 8 "github.com/mutagen-io/mutagen/cmd" 9 10 "github.com/mutagen-io/mutagen/pkg/mutagen" 11 ) 12 13 // legalMain is the entry point for the legal command. 14 func legalMain(_ *cobra.Command, _ []string) error { 15 // Print license information. 16 fmt.Print(mutagen.Licenses) 17 18 // Success. 19 return nil 20 } 21 22 // legalCommand is the legal command. 23 var legalCommand = &cobra.Command{ 24 Use: "legal", 25 Short: "Show legal information", 26 Args: cmd.DisallowArguments, 27 RunE: legalMain, 28 SilenceUsage: true, 29 } 30 31 // legalConfiguration stores configuration for the legal command. 32 var legalConfiguration struct { 33 // help indicates whether or not to show help information and exit. 34 help bool 35 } 36 37 func init() { 38 // Grab a handle for the command line flags. 39 flags := legalCommand.Flags() 40 41 // Disable alphabetical sorting of flags in help output. 42 flags.SortFlags = false 43 44 // Manually add a help flag to override the default message. Cobra will 45 // still implement its logic automatically. 46 flags.BoolVarP(&legalConfiguration.help, "help", "h", false, "Show help information") 47 }