// common contains common functionality for blasphem. package common import ( "github.com/spf13/cobra" ) const ( // AppName is the name of the application. AppName = "blasphem" ) type cmdOptions interface { Options(*cobra.Command, []string) error Execute() error } // RunE is a convenience function for use with cobra. func RunE(c cmdOptions) func(cmd *cobra.Command, args []string) error { return func(cmd *cobra.Command, args []string) error { err := c.Options(cmd, args) if err != nil { cmd.SilenceUsage = true return err } err = c.Execute() if err != nil { cmd.SilenceUsage = true } return err } }