Turn survey options into variables so they can't accidentally become unsynced with default value

This commit is contained in:
Sam Coe 2021-10-19 08:55:30 -07:00
parent c7f79e8447
commit 2135918c47
No known key found for this signature in database
GPG key ID: 8E322C20F811D086

View file

@ -241,9 +241,11 @@ func createRun(opts *CreateOptions) error {
opts.Body = text
}
var defaultSubmit string
saveAsDraft := "Save as draft"
publishRelease := "Publish release"
defaultSubmit := publishRelease
if opts.Draft {
defaultSubmit = "Save as draft"
defaultSubmit = saveAsDraft
}
qs = []*survey.Question{
@ -259,8 +261,8 @@ func createRun(opts *CreateOptions) error {
Prompt: &survey.Select{
Message: "Submit?",
Options: []string{
"Publish release",
"Save as draft",
publishRelease,
saveAsDraft,
"Cancel",
},
Default: defaultSubmit,