feat(contact): Improve Contact information with name, mail and URL
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
05ecb05132
commit
9107f0d36e
12
cmd/init.go
12
cmd/init.go
@ -130,9 +130,17 @@ func runInitAction(cmd *cobra.Command, args []string) {
|
||||
log.Info("Description of the project:")
|
||||
config.ProjectDescription = helpers.StringInput()
|
||||
|
||||
// ask project owner
|
||||
// ask project contact
|
||||
config.ProjectContact = models.ProjectContactStruct{}
|
||||
|
||||
log.Info("Mail address of the developer team:")
|
||||
config.ProjectOwner = helpers.StringInput()
|
||||
config.ProjectContact.Email = helpers.StringInput()
|
||||
|
||||
log.Info("Name of the team:")
|
||||
config.ProjectContact.Name = helpers.StringInput()
|
||||
|
||||
log.Info("URL of the contact informatino of the team:")
|
||||
config.ProjectContact.URL = helpers.StringInput()
|
||||
|
||||
// launch GetInitializeUserInput from selected api type
|
||||
log.Debug("Get user input for the selected API type")
|
||||
|
@ -14,7 +14,13 @@ import (
|
||||
type apiYamlTemplate struct {
|
||||
ProjectDescription string
|
||||
ProjectName string
|
||||
ProjectOwner string
|
||||
ProjectContact apiYamlContact
|
||||
}
|
||||
|
||||
type apiYamlContact struct {
|
||||
Email string
|
||||
Name string
|
||||
URL string
|
||||
}
|
||||
|
||||
// generateAPIYamls will generate a readme based on the given config.
|
||||
@ -45,7 +51,11 @@ func (a APIType) generateAPIYamls(path string, config *models.Config) error {
|
||||
data := apiYamlTemplate{
|
||||
ProjectDescription: config.ProjectDescription,
|
||||
ProjectName: config.ProjectName,
|
||||
ProjectOwner: config.ProjectOwner,
|
||||
ProjectContact: apiYamlContact{
|
||||
Email: config.ProjectContact.Email,
|
||||
Name: config.ProjectContact.Name,
|
||||
URL: config.ProjectContact.URL,
|
||||
},
|
||||
}
|
||||
|
||||
for _, templateFile := range templateFileList {
|
||||
|
@ -2,12 +2,19 @@ package models
|
||||
|
||||
// Config structure represent the main configuration of the project.
|
||||
type Config struct {
|
||||
ProjectName string `yaml:"project_name"`
|
||||
ProjectDescription string `yaml:"project_description"`
|
||||
ProjectOwner string `yaml:"project_owner"`
|
||||
ProjectType APITypeName `yaml:"project_type"`
|
||||
ModulePath *string `yaml:"module_name"`
|
||||
Features FeaturesConfig `yaml:"features"`
|
||||
ProjectName string `yaml:"project_name"`
|
||||
ProjectDescription string `yaml:"project_description"`
|
||||
ProjectContact ProjectContactStruct `yaml:"project_contact"`
|
||||
ProjectType APITypeName `yaml:"project_type"`
|
||||
ModulePath *string `yaml:"module_name"`
|
||||
Features FeaturesConfig `yaml:"features"`
|
||||
}
|
||||
|
||||
// ProjectContactStruct contain all contact information for that project.
|
||||
type ProjectContactStruct struct {
|
||||
Name string `yaml:"name"`
|
||||
Email string `yaml:"email"`
|
||||
URL string `yaml:"url"`
|
||||
}
|
||||
|
||||
// FeaturesConfig structure represent the configuration of all possible features.
|
||||
|
@ -5,7 +5,9 @@ info:
|
||||
title: "{{ .ProjectName }}"
|
||||
description: "{{ .ProjectDescription }}"
|
||||
contact:
|
||||
email: "{{ .ProjectOwner }}"
|
||||
name: "{{ .ProjectContact.Name }}"
|
||||
email: "{{ .ProjectContact.Email }}"
|
||||
url: "{{ .ProjectContact.URL }}"
|
||||
consumes:
|
||||
- "application/json"
|
||||
produces:
|
||||
|
Loading…
Reference in New Issue
Block a user