Defer campaign loading in the wrappers
This commit is contained in:
parent
2f6d27d831
commit
a40693b493
1 changed files with 12 additions and 12 deletions
24
cmd/root.go
24
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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue