Defer campaign loading in the wrappers
This commit is contained in:
parent
2f6d27d831
commit
a40693b493
1 changed files with 12 additions and 12 deletions
|
@ -10,25 +10,25 @@ import (
|
|||
)
|
||||
|
||||
func withApp(f func(*app.App, *cobra.Command, []string)) func(*cobra.Command, []string) {
|
||||
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)
|
||||
}
|
||||
|
||||
return func(cmd *cobra.Command, args []string) {
|
||||
f(a, cmd, args)
|
||||
}
|
||||
}
|
||||
|
||||
func withAppE(f func(*app.App, *cobra.Command, []string) error) func(*cobra.Command, []string) error {
|
||||
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 func(cmd *cobra.Command, args []string) error {
|
||||
return f(a, cmd, args)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue