diff --git a/examples/options/options.variant b/examples/options/options.variant index ec86cd0..6b88aa0 100644 --- a/examples/options/options.variant +++ b/examples/options/options.variant @@ -1,17 +1,21 @@ option "int1" { type = number + description = "The number to be referenced by $${opt.int1} e.g. 1, 2" } option "ints1" { type = list(number) + description = "The list of numbers to be referenced by $${opt.ints1} e.g. 12" } option "str1" { type = string + description = "The string to be referenced by $${opt.sr1} e.g. a, b" } option "strs1" { type = list(string) + description = "The list of strings to be referenced by $${opt.strs1} e.g. bc" } job "test" { diff --git a/pkg/app/survey.go b/pkg/app/survey.go index 4f7913d..359c8e8 100644 --- a/pkg/app/survey.go +++ b/pkg/app/survey.go @@ -25,13 +25,13 @@ func makeQuestions(pendingOptions []PendingOption) ([]*survey.Question, map[stri var msg string + var description string + if op.Spec.Description != nil { - msg = *op.Spec.Description - } else { - msg = name + description = *op.Spec.Description } - msg = msg + "?" + msg = name var validate survey.Validator @@ -43,10 +43,12 @@ func makeQuestions(pendingOptions []PendingOption) ([]*survey.Question, map[stri case cty.String: prompt = &survey.Input{ Message: msg, + Help: description, } case cty.Number: prompt = &survey.Input{ Message: msg, + Help: description, } transform = func(ans interface{}) (newAns interface{}) { @@ -69,11 +71,13 @@ func makeQuestions(pendingOptions []PendingOption) ([]*survey.Question, map[stri case cty.Bool: prompt = &survey.Confirm{ Message: msg, + Help: description, Default: false, } case cty.List(cty.String): prompt = &survey.Multiline{ Message: msg, + Help: description, } transform = func(ans interface{}) (newAns interface{}) { @@ -93,6 +97,7 @@ func makeQuestions(pendingOptions []PendingOption) ([]*survey.Question, map[stri case cty.List(cty.Number): prompt = &survey.Multiline{ Message: msg, + Help: description, } transform = func(ans interface{}) (newAns interface{}) {