Skip to content

Commit

Permalink
fix: only offer scaffolding when possible
Browse files Browse the repository at this point in the history
Fixes #65
  • Loading branch information
metacosm committed Jan 16, 2020
1 parent 28c44d6 commit fe618d1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/hal/cli/component/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,22 @@ func (o *createOptions) Complete(name string, cmd *cobra.Command, args []string)
o.port = intPort
}

r := runtimes[o.runtime]
hasGenerator := len(r.generator) > 0
if len(o.scaffoldP) == 0 {
o.scaffold = ui.Proceed("Use code generator")
o.scaffold = hasGenerator && ui.Proceed("Use code generator")
} else {
b, err := strconv.ParseBool(o.scaffoldP)
if err != nil {
return err
}
o.scaffold = b
if b && !hasGenerator {
ui.OutputError(fmt.Sprintf("ignoring scaffolding option because unsupported by %s runtime", r.name))
}
o.scaffold = hasGenerator && b
}

r := runtimes[o.runtime]
if len(r.generator) > 0 && o.scaffold {
if o.scaffold {
o.GroupId = ui.Ask("Group Id", o.GroupId, "dev.snowdrop")
o.ArtifactId = ui.Ask("Artifact Id", o.ArtifactId, "myproject")
o.ProjectVersion = ui.Ask("Version", o.ProjectVersion, "1.0.0-SNAPSHOT")
Expand Down

0 comments on commit fe618d1

Please sign in to comment.