Skip to content

Commit bdc1ccd

Browse files
authored
feat: Add an info box showing more context during the info command (#391)
* feat: Add an info box showing more context during the info command * fix: fix failing prompt test
1 parent fb67316 commit bdc1ccd

File tree

7 files changed

+64
-21
lines changed

7 files changed

+64
-21
lines changed

cmd/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var (
2020
)
2121

2222
func init() {
23-
createCmd.PersistentFlags().StringVarP(&createConfigPath, "config", "c", constants.ZeroProjectYml, "config path")
23+
createCmd.PersistentFlags().StringVarP(&createConfigPath, "config", "c", constants.ZeroProjectYml, "The project.yml file to load. The default is the one in the current directory.")
2424
createCmd.PersistentFlags().BoolVarP(&overwriteFiles, "overwrite", "o", false, "overwrite pre-existing files")
2525

2626
rootCmd.AddCommand(createCmd)

go.mod

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.13
44

55
require (
66
github.com/aws/aws-sdk-go v1.30.12
7+
github.com/buger/goterm v1.0.0
78
github.com/coreos/go-semver v0.2.0
89
github.com/gabriel-vasile/mimetype v1.1.1
910
github.com/google/go-cmp v0.3.1
@@ -12,24 +13,24 @@ require (
1213
github.com/hashicorp/go-version v1.2.1
1314
github.com/hashicorp/terraform v0.12.26
1415
github.com/iancoleman/strcase v0.1.2
15-
github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a // indirect
16+
github.com/juju/ansiterm v0.0.0-20210706145210-9283cdf370b5 // indirect
1617
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
1718
github.com/k0kubun/pp v3.0.1+incompatible
1819
github.com/kyokomi/emoji v2.1.0+incompatible
1920
github.com/logrusorgru/aurora v0.0.0-20191017060258-dc85c304c434
2021
github.com/lunixbochs/vtclean v1.0.0 // indirect
2122
github.com/machinebox/graphql v0.2.2
22-
github.com/manifoldco/promptui v0.3.0
23+
github.com/manifoldco/promptui v0.8.0
2324
github.com/matryer/is v1.3.0 // indirect
24-
github.com/mattn/go-colorable v0.1.2 // indirect
25+
github.com/mattn/go-colorable v0.1.8 // indirect
26+
github.com/mattn/go-isatty v0.0.13 // indirect
2527
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
26-
github.com/pkg/errors v0.9.1
2728
github.com/sirupsen/logrus v1.2.0
2829
github.com/spf13/cobra v0.0.6
2930
github.com/stretchr/testify v1.5.1
3031
github.com/termie/go-shutil v0.0.0-20140729215957-bcacb06fecae
3132
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b // indirect
32-
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 // indirect
33+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
3334
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
3435
gopkg.in/yaml.v2 v2.2.2
3536

go.sum

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB
6767
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
6868
github.com/bmatcuk/doublestar v1.1.5/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE=
6969
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
70+
github.com/buger/goterm v1.0.0 h1:ZB6uUlY8+sjJyFGzz2WpRqX2XYPeXVgtZAOJMwOsTWM=
71+
github.com/buger/goterm v1.0.0/go.mod h1:16STi3LquiscTIHA8SXUNKEa/Cnu4ZHBH8NsCaWgso0=
7072
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
7173
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
7274
github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s=
@@ -99,6 +101,7 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m
99101
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
100102
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
101103
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
104+
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
102105
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
103106
github.com/gabriel-vasile/mimetype v1.1.1 h1:qbN9MPuRf3bstHu9zkI9jDWNfH//9+9kHxr9oRBBBOA=
104107
github.com/gabriel-vasile/mimetype v1.1.1/go.mod h1:6CDPel/o/3/s4+bp6kIbsWATq8pmgOisOPG40CJa6To=
@@ -222,6 +225,8 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1
222225
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
223226
github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a h1:FaWFmfWdAUKbSCtOU2QjDaorUexogfaMgbipgYATUMU=
224227
github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU=
228+
github.com/juju/ansiterm v0.0.0-20210706145210-9283cdf370b5 h1:Q5klzs6BL5FkassBX65t+KkG0XjYcjxEm+GNcQAsuaw=
229+
github.com/juju/ansiterm v0.0.0-20210706145210-9283cdf370b5/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU=
225230
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
226231
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM=
227232
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
@@ -254,27 +259,29 @@ github.com/likexian/simplejson-go v0.0.0-20190419151922-c1f9f0b4f084/go.mod h1:U
254259
github.com/likexian/simplejson-go v0.0.0-20190502021454-d8787b4bfa0b/go.mod h1:3BWwtmKP9cXWwYCr5bkoVDEfLywacOv0s06OBEDpyt8=
255260
github.com/logrusorgru/aurora v0.0.0-20191017060258-dc85c304c434 h1:im9kkmH0WWwxzegiv18gSUJbuXR9y028rXrWuPp6Jug=
256261
github.com/logrusorgru/aurora v0.0.0-20191017060258-dc85c304c434/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
262+
github.com/lunixbochs/vtclean v0.0.0-20180621232353-2d01aacdc34a/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI=
257263
github.com/lunixbochs/vtclean v1.0.0 h1:xu2sLAri4lGiovBDQKxl5mrXyESr3gUr5m5SM5+LVb8=
258264
github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI=
259265
github.com/lusis/go-artifactory v0.0.0-20160115162124-7e4ce345df82/go.mod h1:y54tfGmO3NKssKveTEFFzH8C/akrSOy/iW9qEAUDV84=
260266
github.com/machinebox/graphql v0.2.2 h1:dWKpJligYKhYKO5A2gvNhkJdQMNZeChZYyBbrZkBZfo=
261267
github.com/machinebox/graphql v0.2.2/go.mod h1:F+kbVMHuwrQ5tYgU9JXlnskM8nOaFxCAEolaQybkjWA=
262268
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
263-
github.com/manifoldco/promptui v0.3.0 h1:vJiVJREqDfn9ZhqTG1Dz5zP9RPWlAzWQkwRYLGyUHx4=
264-
github.com/manifoldco/promptui v0.3.0/go.mod h1:zoCNXiJnyM03LlBgTsWv8mq28s7aTC71UgKasqRJHww=
269+
github.com/manifoldco/promptui v0.8.0 h1:R95mMF+McvXZQ7j1g8ucVZE1gLP3Sv6j9vlF9kyRqQo=
270+
github.com/manifoldco/promptui v0.8.0/go.mod h1:n4zTdgP0vr0S3w7/O/g98U+e0gwLScEXGwov2nIKuGQ=
265271
github.com/masterzen/simplexml v0.0.0-20160608183007-4572e39b1ab9/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc=
266272
github.com/masterzen/winrm v0.0.0-20190223112901-5e5c9a7fe54b/go.mod h1:wr1VqkwW0AB5JS0QLy5GpVMS9E3VtRoSYXUYyVk46KY=
267273
github.com/matryer/is v1.3.0 h1:9qiso3jaJrOe6qBRJRBt2Ldht05qDiFP9le0JOIhRSI=
268274
github.com/matryer/is v1.3.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
269275
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
270276
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
271-
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
272-
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
277+
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
278+
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
273279
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
274280
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
275281
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
276-
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
277-
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
282+
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
283+
github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA=
284+
github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
278285
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
279286
github.com/mattn/go-shellwords v1.0.4/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
280287
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
@@ -447,6 +454,7 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h
447454
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
448455
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
449456
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
457+
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
450458
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
451459
golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
452460
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -458,8 +466,12 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w
458466
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
459467
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
460468
golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
461-
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 h1:OjiUf46hAmXblsZdnoSXsEUSKU8r1UEzcL5RVZ4gO9Y=
462-
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
469+
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
470+
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
471+
golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54 h1:rF3Ohx8DRyl8h2zw9qojyLHLhrJpEMgyPOImREEryf0=
472+
golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
473+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
474+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
463475
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
464476
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
465477
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

internal/generate/generate_modules.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func Generate(projectConfig projectconfig.ZeroProjectConfig, overwriteFiles bool
3939
// Load module configuration
4040
moduleConfig, err := module.ParseModuleConfig(mod.Files.Source)
4141
if err != nil {
42-
return fmt.Errorf("unable to load module: %v", err)
42+
return fmt.Errorf("unable to load module (%s): %v", mod.Files.Source, err)
4343
}
4444

4545
moduleDir := path.Join(module.GetSourceDir(mod.Files.Source), moduleConfig.InputDir)

internal/init/init.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func loadAllModules(moduleSources []string) (map[string]moduleconfig.ModuleConfi
8989
for _, moduleSource := range moduleSources {
9090
mod, err := module.ParseModuleConfig(moduleSource)
9191
if err != nil {
92-
exit.Fatal("Unable to load module: %v\n", err)
92+
exit.Fatal("Unable to load module (%s): %v\n", moduleSource, err)
9393
}
9494
modules[mod.Name] = mod
9595
mappedSources[mod.Name] = moduleSource
@@ -104,6 +104,7 @@ func getProjectNamePrompt() PromptHandler {
104104
Parameter: moduleconfig.Parameter{
105105
Field: "projectName",
106106
Label: "Project Name",
107+
Info: "This name will be used in most of the resources that are created and should be unique within an AWS account.",
107108
Default: "",
108109
},
109110
Condition: NoCondition,
@@ -117,6 +118,7 @@ func getProjectPrompts(projectName string, modules map[string]moduleconfig.Modul
117118
Parameter: moduleconfig.Parameter{
118119
Field: "ShouldPushRepositories",
119120
Label: "Should the created projects be checked into github automatically?",
121+
Info: "If yes, we will automatically create repositories for you in github and check in the generated code.\nIf no, you will need to do these steps manually after running the zero create command.",
120122
Options: yaml.MapSlice{
121123
yaml.MapItem{Key: "y", Value: "yes"},
122124
yaml.MapItem{Key: "n", Value: "no"},
@@ -129,6 +131,7 @@ func getProjectPrompts(projectName string, modules map[string]moduleconfig.Modul
129131
Parameter: moduleconfig.Parameter{
130132
Field: "GithubRootOrg",
131133
Label: "What's the root of the github org to create repositories in?",
134+
Info: "This should be github.com/<your-organization-name>",
132135
Default: "github.com/",
133136
},
134137
Condition: KeyMatchCondition("ShouldPushRepositories", "y"),
@@ -143,6 +146,7 @@ func getProjectPrompts(projectName string, modules map[string]moduleconfig.Modul
143146
Parameter: moduleconfig.Parameter{
144147
Field: moduleName,
145148
Label: label,
149+
Info: "This will be used as the name of the repository.",
146150
Default: module.OutputDir,
147151
},
148152
Condition: NoCondition,
@@ -171,8 +175,10 @@ func chooseCloudProvider(projectConfig *projectconfig.ZeroProjectConfig) {
171175
}
172176

173177
func chooseStack(reg registry.Registry) []string {
178+
showInfoBox("A stack is a group of Zero modules. They will be pulled in from the registry and templated to create the different parts of your project such as infrastructure, backend, frontend, etc.")
179+
174180
providerPrompt := promptui.Select{
175-
Label: "Pick a stack you'd like to use",
181+
Label: "Pick the stack you'd like to use",
176182
Items: registry.AvailableLabels(reg),
177183
}
178184
_, providerResult, err := providerPrompt.Run()

internal/init/prompts.go

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"regexp"
1010
"strings"
1111

12+
tm "github.com/buger/goterm"
1213
"github.com/commitdev/zero/internal/config/moduleconfig"
1314
"github.com/commitdev/zero/internal/constants"
1415
"github.com/commitdev/zero/internal/util"
@@ -100,6 +101,19 @@ func ValidateProjectName(input string) error {
100101
return nil
101102
}
102103

104+
const infoBoxHeight = 4
105+
106+
var currentLine int = infoBoxHeight
107+
108+
// showInfoBox prints a box with some text in it, and the title "Info"
109+
func showInfoBox(infoText string) {
110+
box := tm.NewBox(100|tm.PCT, 4, 0)
111+
fmt.Fprint(box, infoText)
112+
tm.Print(tm.MoveTo(box.String(), 1, 1))
113+
tm.MoveCursor(4, 1)
114+
tm.Printf("Info")
115+
}
116+
103117
// RunPrompt obtains the value of PromptHandler depending on the parameter's definition
104118
// for the project config, there are multiple ways of obtaining the value
105119
// values go into params depending on `Condition` as the highest precedence (Whether it gets this value)
@@ -113,9 +127,13 @@ func (p PromptHandler) RunPrompt(projectParams map[string]string, envVarTranslat
113127
var result string
114128

115129
if p.Condition(projectParams) {
116-
if p.Parameter.Info != "" {
117-
flog.Guidef(p.Parameter.Info)
130+
131+
// If we start printing below the bottom of the terminal screen, go back to the top
132+
if currentLine+infoBoxHeight+1 > tm.Height() {
133+
tm.Clear()
134+
currentLine = infoBoxHeight
118135
}
136+
119137
// TODO: figure out scope of projectParams per project
120138
// potentially dangerous to have cross module env leaking
121139
// so if community module has an `execute: twitter tweet $ENV`
@@ -127,6 +145,12 @@ func (p PromptHandler) RunPrompt(projectParams map[string]string, envVarTranslat
127145
} else if p.Parameter.Value != "" {
128146
result = p.Parameter.Value
129147
} else {
148+
showInfoBox(p.Parameter.Info)
149+
// Move down to the next line to show the prompt
150+
currentLine++
151+
tm.MoveCursor(1, currentLine)
152+
tm.Flush() // Call it every time at the end of rendering
153+
130154
err, result = promptParameter(p)
131155
}
132156
if err != nil {

internal/init/prompts_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func TestGetParam(t *testing.T) {
1717
t.Run("Should execute params without prompt", func(t *testing.T) {
1818
param := moduleconfig.Parameter{
1919
Field: "account-id",
20-
Execute: "echo \"my-acconut-id\"",
20+
Execute: "echo \"my-account-id\"",
2121
}
2222

2323
prompt := initPrompts.PromptHandler{
@@ -27,7 +27,7 @@ func TestGetParam(t *testing.T) {
2727
}
2828

2929
prompt.RunPrompt(projectParams, envVarTranslationMap)
30-
assert.Equal(t, "my-acconut-id", projectParams[param.Field])
30+
assert.Equal(t, "my-account-id", projectParams[param.Field])
3131
})
3232

3333
t.Run("executes with project context", func(t *testing.T) {

0 commit comments

Comments
 (0)