feat(apiType): Start to implement apiType system

This commit is contained in:
Matthieu 'JP' DERASSE
2022-07-25 20:20:10 +00:00
parent 66ff28f6cd
commit ec6485aa45
8 changed files with 133 additions and 1 deletions

View File

@ -6,8 +6,10 @@ package cmd
import (
"os"
"strings"
"git.home.m-and-m.ovh/mderasse/boot/helpers"
"git.home.m-and-m.ovh/mderasse/boot/helpers/api_type"
"github.com/spf13/cobra"
log "github.com/sirupsen/logrus"
@ -40,7 +42,7 @@ func runInitAction(cmd *cobra.Command, args []string) {
log.Debugf("Starting command Init")
log.Debugf("Checking dependecies")
log.Debugf("Checking dependencies")
if !checkDependencies() {
return
@ -83,6 +85,16 @@ func runInitAction(cmd *cobra.Command, args []string) {
return
}
// ask which API type we want to use
var possibleApiTypes []string
for _, apiType := range api_type.GetListOfApiTypeName() {
possibleApiTypes = append(possibleApiTypes, string(apiType))
}
log.Infof("Which kind of API do you want to init (possible values: %s)", strings.Join(possibleApiTypes, ", "))
apiType := helpers.ApiTypeInput()
log.Debugf("Using api type : %s", apiType)
// XXX:
// Check we are in gopath or ask for the gomod name
// Create directory