feat(config): Write and read config + refacto
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Matthieu 'JP' DERASSE
2022-08-05 14:20:00 +00:00
parent 2304a11465
commit 645344fa5c
8 changed files with 75 additions and 24 deletions

View File

@ -7,6 +7,6 @@ import (
)
// GetInitializeUserInput will ask user to provide information that allow initialization of a project.
func (a APIType) GetInitializeUserInput(params *models.UserInputParams) (*models.UserInputParams, error) {
func (a APIType) GetInitializeUserInput(params *models.Config) (*models.Config, error) {
return nil, errors.NotImplementedf("GetInitializeUserInput not implemented for %s", a.GetName())
}

View File

@ -12,7 +12,7 @@ import (
)
// GetInitializeUserInput will ask user to provide information that allow initialization of a project.
func (a APIType) GetInitializeUserInput(params *models.UserInputParams) (*models.UserInputParams, error) {
func (a APIType) GetInitializeUserInput(params *models.Config) (*models.Config, error) {
log.Debugf("Starting %s user input", a.GetName())
// Get current path
@ -33,11 +33,11 @@ func (a APIType) GetInitializeUserInput(params *models.UserInputParams) (*models
log.Debug("We are not in GoPath, ask extra info")
goModulePath := helpers.StringInput()
log.Info("Go Module name:")
params.GoModuleName = &goModulePath
params.ModuleName = &goModulePath
}
log.Info("Do you want to enable database models auto generation ?")
params.DatabaseModels = helpers.YesOrNoInput()
params.Features.DatabaseModels.Enabled = helpers.YesOrNoInput()
return params, nil
}

View File

@ -6,5 +6,5 @@ import "git.home.m-and-m.ovh/mderasse/gouick/helpers/models"
type APITypeInterface interface {
CheckInitialize() error
GetName() models.APITypeName
GetInitializeUserInput(params *models.UserInputParams) (*models.UserInputParams, error)
GetInitializeUserInput(params *models.Config) (*models.Config, error)
}