Skip to content

Commit f9527c7

Browse files
Merge pull request #197 from intelops/fix-issue
fix: json parser issues
2 parents 0c89684 + 55a967e commit f9527c7

File tree

4 files changed

+132
-1487
lines changed

4 files changed

+132
-1487
lines changed

cmd/generate.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,25 @@ var generateCmd = &cobra.Command{
1818
1919
Change the file as per your needs and then run the compage generate command to generate the code.`,
2020
Run: func(cmd *cobra.Command, args []string) {
21-
err := GenerateCode()
21+
wD, err := os.Getwd()
22+
if err != nil {
23+
log.Errorf("error while getting the current directory [" + err.Error() + "]")
24+
return
25+
}
26+
// set the project directory environment variable, if this is set, then the project will be generated in this folder
27+
err = os.Setenv("COMPAGE_GENERATED_PROJECT_DIRECTORY", wD)
28+
if err != nil {
29+
log.Errorf("error while setting the project directory [" + err.Error() + "]")
30+
return
31+
}
32+
33+
err = GenerateCode()
2234
cobra.CheckErr(err)
2335
},
2436
}
2537

2638
func init() {
2739
rootCmd.AddCommand(generateCmd)
28-
wD, err := os.Getwd()
29-
if err != nil {
30-
log.Errorf("error while getting the current directory [" + err.Error() + "]")
31-
return
32-
}
33-
// set the project directory environment variable, if this is set, then the project will be generated in this folder
34-
err = os.Setenv("COMPAGE_GENERATED_PROJECT_DIRECTORY", wD)
35-
if err != nil {
36-
log.Errorf("error while setting the project directory [" + err.Error() + "]")
37-
return
38-
}
3940
// Here you will define your flags and configuration settings.
4041

4142
// Cobra supports Persistent Flags which will work for this command

0 commit comments

Comments
 (0)