Skip to content

Commit

Permalink
feat: handle error log when nth is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
mukezhz committed Jan 7, 2024
1 parent 855c1c9 commit b5e02fa
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cmd/add_infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,23 @@ func addInfrastructureHandler(_ *cobra.Command, args []string) {
}

terminal.StartInteractiveTerminal(questions)

addInfrastructure(questions, infrasTmpl, infrastructureModulePath, data, false)
if len(infrasTmpl) == 0 {
color.Red.Println("No infrastructure selected")
}
items := addInfrastructure(questions, infrasTmpl, infrastructureModulePath, data, false)
if len(items) == 0 {
color.Red.Println("No infrastructure selected")
return
}
utility.PrintColorizeInfrastructureDetail(data, infras)
}

func addInfrastructure(questions []terminal.ProjectQuestion, infrasTmpl []string, infrastructureModulePath string, data model.ModuleData, isNewProject bool) []int {
var functions []string
var items []int
if len(items) == 0 {
return items
}
for _, q := range questions {
switch q.Key {
case constant.InfrastructureNameKEY:
Expand Down

0 comments on commit b5e02fa

Please sign in to comment.