mirror of
https://github.com/foomo/gocontentful.git
synced 2025-10-16 12:25:39 +00:00
feat: rename flag and variables env to enviroment
This commit is contained in:
parent
d11acea542
commit
55d3ab9cd2
10
erm/space.go
10
erm/space.go
@ -68,14 +68,14 @@ func getContentTypes(CMA *contentful.Contentful, spaceID string) (contentTypes [
|
||||
return
|
||||
}
|
||||
|
||||
func getData(spaceID, cmaKey, env string, flagContentTypes []string) (
|
||||
func getData(spaceID, cmaKey, environment string, flagContentTypes []string) (
|
||||
finalContentTypes []ContentType, locales []Locale, err error,
|
||||
) {
|
||||
// Get client
|
||||
CMA := contentful.NewCMA(cmaKey)
|
||||
CMA.Debug = false
|
||||
if env != "" {
|
||||
CMA.Environment = env
|
||||
if environment != "" {
|
||||
CMA.Environment = environment
|
||||
}
|
||||
|
||||
// Get space locales
|
||||
@ -111,8 +111,8 @@ func getData(spaceID, cmaKey, env string, flagContentTypes []string) (
|
||||
}
|
||||
|
||||
// GenerateAPI calls the generators
|
||||
func GenerateAPI(dir, packageName, spaceID, cmaKey, env string, flagContentTypes []string) (err error) {
|
||||
contentTypes, locales, errGetData := getData(spaceID, cmaKey, env, flagContentTypes)
|
||||
func GenerateAPI(dir, packageName, spaceID, cmaKey, environment string, flagContentTypes []string) (err error) {
|
||||
contentTypes, locales, errGetData := getData(spaceID, cmaKey, environment, flagContentTypes)
|
||||
if errGetData != nil {
|
||||
return errGetData
|
||||
}
|
||||
|
||||
4
main.go
4
main.go
@ -35,7 +35,7 @@ func main() {
|
||||
// Get parameters from cmd line flags
|
||||
flagSpaceID := flag.String("spaceid", "", "Contentful space ID")
|
||||
flagCMAKey := flag.String("cmakey", "", "Contentful CMA key")
|
||||
flagEnv := flag.String("env", "", "Contentful enviroment")
|
||||
flagEnvironment := flag.String("environment", "", "Contentful space environment")
|
||||
flagContentTypes := flag.String("contenttypes", "", "[Optional] Content type IDs to parse, comma separated")
|
||||
flagVersion := flag.Bool("version", false, "Print version and exit")
|
||||
flagHelp := flag.Bool("help", false, "Print version and exit")
|
||||
@ -76,7 +76,7 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
err = erm.GenerateAPI(filepath.Dir(path), packageName, *flagSpaceID, *flagCMAKey, *flagEnv, flagContentTypesSlice)
|
||||
err = erm.GenerateAPI(filepath.Dir(path), packageName, *flagSpaceID, *flagCMAKey, *flagEnvironment, flagContentTypesSlice)
|
||||
if err != nil {
|
||||
fatal("Something went horribly wrong...", err)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user