diff --git a/cmd/root.go b/cmd/root.go index 81f9010..fb880a9 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -10,25 +10,25 @@ import ( ) func withApp(f func(*app.App, *cobra.Command, []string)) func(*cobra.Command, []string) { - a, err := app.NewApp("./campaign.json") - if err != nil { - fmt.Fprintln(os.Stderr, "ERROR: "+err.Error()) - os.Exit(1) - } - return func(cmd *cobra.Command, args []string) { + a, err := app.NewApp("./campaign.json") + if err != nil { + fmt.Fprintln(os.Stderr, "ERROR: "+err.Error()) + os.Exit(1) + } + f(a, cmd, args) } } func withAppE(f func(*app.App, *cobra.Command, []string) error) func(*cobra.Command, []string) error { - a, err := app.NewApp("./campaign.json") - if err != nil { - fmt.Fprintln(os.Stderr, "ERROR: "+err.Error()) - os.Exit(1) - } - return func(cmd *cobra.Command, args []string) error { + a, err := app.NewApp("./campaign.json") + if err != nil { + fmt.Fprintln(os.Stderr, "ERROR: "+err.Error()) + os.Exit(1) + } + return f(a, cmd, args) } }