Skip to content

Commit 84823bc

Browse files
committed
Make show speaker return to main menu work
1 parent 4358507 commit 84823bc

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

cmd/prompt.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ func showSpeakerPrompt(city, year string) (err error) {
115115
break
116116
}
117117
}
118-
speaker.ShowSpeakers(city, year)
118+
exitCode, err = speaker.ShowSpeakers(city, year)
119+
if exitCode == true {
120+
return
121+
}
119122

120123
}
121124
return

event/event.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"path/filepath"
1010
"regexp"
1111
"strings"
12-
12+
1313
"text/template"
1414

1515
helpers "github.com/devopsdays/devopsdays-cli/helpers"
@@ -32,7 +32,7 @@ var qsCreateEvent = []*survey.Question{
3232
Help: "Twitter username can include the @ symbol or not. Examples: '@devopsdays' or 'devopsdays",
3333
},
3434
Validate: func(val interface{}) error {
35-
if str, _ := val.(string); (str != "") && (helpers.ValidateField(str, "twitter") == false) {
35+
if str, _ := val.(string); (str != "") && !helpers.ValidateField(str, "twitter") {
3636
return errors.New("Please enter a valid Twitter handle. Spaces are not allowed.")
3737
}
3838
return nil

speaker/show_speakers.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
survey "gopkg.in/AlecAivazis/survey.v1"
1010
)
1111

12-
func ShowSpeakers(city, year string) (err error) {
12+
func ShowSpeakers(city, year string) (exitCode bool, err error) {
1313
var selection string
1414

1515
speakerList, _ := GetSpeakers(city, year)
@@ -23,7 +23,7 @@ func ShowSpeakers(city, year string) (err error) {
2323
}
2424
survey.AskOne(prompt, &selection, nil)
2525
if selection == "Return to Main Menu" {
26-
return
26+
return true, nil
2727
}
2828
speakerFileName := strings.Join([]string{strings.TrimSpace(names.NameClean(selection)), ".md"}, "")
2929

@@ -57,5 +57,5 @@ func ShowSpeakers(city, year string) (err error) {
5757
color.Cyan("+-+-+-+-+-+-+-+-+-+-+-+-+-+-+")
5858
fmt.Println()
5959
}
60-
return
60+
return true, nil
6161
}

0 commit comments

Comments
 (0)