Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
dvaumoron committed Oct 12, 2023
1 parent c33f810 commit f777fa1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,19 @@ https://github.com/dvaumoron/cornucopia`,
thread := &starlark.Thread{Name: common.Prefix + scriptname, Load: loader.Load}
glu.InitCornucopiaGlobals()

if _, err = starlark.ExecFile(thread, scriptname, nil, nil); err != nil {
if len(glu.GeneratedFilenames) != 0 {
_, err = starlark.ExecFile(thread, scriptname, nil, nil)
generated := len(glu.GeneratedFilenames) != 0
if err != nil {
if generated {
displayGeneratedFileNames("Before error, the following file have been generated :")
}
return err
}

if len(glu.GeneratedFilenames) == 0 {
fmt.Println("Successful without file generation")
} else {
if generated {
displayGeneratedFileNames("Successful, the following file have been generated :")
} else {
fmt.Println("Successful without file generation")
}
return nil
},
Expand Down

0 comments on commit f777fa1

Please sign in to comment.