diff --git a/cmd/root.go b/cmd/root.go index 6049173..7a1bb38 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -9,7 +9,6 @@ import ( "github.com/spf13/viper" "github.com/gomicro/forge/confile" - clifmt "github.com/gomicro/forge/fmt" ) func init() { @@ -18,28 +17,28 @@ func init() { RootCmd.PersistentFlags().Bool("verbose", false, "show more verbose output") err := viper.BindPFlag("verbose", RootCmd.PersistentFlags().Lookup("verbose")) if err != nil { - clifmt.Printf("Error setting up: %v\n", err.Error()) + fmt.Printf("Error setting up: %s\n", err) os.Exit(1) } RootCmd.PersistentFlags().Bool("solo", false, "run a step solo, without its pre or post steps") err = viper.BindPFlag("solo", RootCmd.PersistentFlags().Lookup("solo")) if err != nil { - clifmt.Printf("Error setting up: %v\n", err.Error()) + fmt.Printf("Error setting up: %s\n", err) os.Exit(1) } RootCmd.PersistentFlags().Bool("no-pre", false, "skip running pre steps") err = viper.BindPFlag("no-pre", RootCmd.PersistentFlags().Lookup("no-pre")) if err != nil { - clifmt.Printf("Error setting up: %v\n", err.Error()) + fmt.Printf("Error setting up: %s\n", err) os.Exit(1) } RootCmd.PersistentFlags().Bool("no-post", false, "skip running post steps") err = viper.BindPFlag("no-post", RootCmd.PersistentFlags().Lookup("no-post")) if err != nil { - clifmt.Printf("Error setting up: %v\n", err.Error()) + fmt.Printf("Error setting up: %s\n", err) os.Exit(1) } } @@ -54,7 +53,6 @@ var RootCmd = &cobra.Command{ Long: `Forge is a CLI tool for executing, in a consistent manner, scripts and commands for building and maintaining projects.`, Args: cobra.MinimumNArgs(1), RunE: rootFunc, - SilenceErrors: true, ValidArgsFunction: validArgsFunc, } @@ -62,7 +60,6 @@ var RootCmd = &cobra.Command{ // This is called by main.main(). It only needs to happen once to the rootCmd. func Execute() { if err := RootCmd.Execute(); err != nil { - clifmt.Printf("Failed to execute: %v\n", err.Error()) os.Exit(1) } } diff --git a/cmd/version.go b/cmd/version.go index 70f52bd..1dfe4a0 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -1,9 +1,9 @@ package cmd import ( - "github.com/spf13/cobra" + "fmt" - "github.com/gomicro/forge/fmt" + "github.com/spf13/cobra" ) func init() { @@ -25,8 +25,8 @@ var versionCmd = &cobra.Command{ func versionFunc(cmd *cobra.Command, args []string) { if Version == "" { - fmt.Printf("Forge version dev-local") + fmt.Printf("Forge version dev-local\n") } else { - fmt.Printf("Forge version %v", Version) + fmt.Printf("Forge version %v\n", Version) } } diff --git a/fmt/fmt.go b/fmt/fmt.go deleted file mode 100644 index 3842a93..0000000 --- a/fmt/fmt.go +++ /dev/null @@ -1,20 +0,0 @@ -package fmt - -import ( - "fmt" - - "github.com/spf13/viper" -) - -// Printf handles all general log messages for commands -func Printf(f string, args ...interface{}) { - fmt.Println(fmt.Sprintf(f, args...)) -} - -// Verbosef handles all log messages noted as verbose and does not show unless -// the verbose flag has been provided to the command -func Verbosef(f string, args ...interface{}) { - if viper.GetBool("verbose") { - fmt.Println(fmt.Sprintf(f, args...)) - } -}