@@ -264,43 +264,59 @@ func SpeakerImage(srcPath, speaker, city, year string) (imageFile string) {
264264func ShowSpeakers (city , year string ) (err error ) {
265265 var selection string
266266
267- options , _ := GetSpeakers (city , year )
268- options = append (options , "Return to Main Menu" )
267+ speakerList , _ := GetSpeakers (city , year )
268+ options2 , _ := listSpeakerNames (speakerList , city , year )
269+
270+ options2 = append (options2 , "Return to Main Menu" )
269271 for selection != "Return to Main Menu" {
270272 prompt := & survey.Select {
271273 Message : "Select a speaker:" ,
272- Options : options ,
274+ Options : options2 ,
273275 }
274276 survey .AskOne (prompt , & selection , nil )
275277 if selection == "Return to Main Menu" {
276278 return
277279 }
280+ speakerFileName := strings .Join ([]string {strings .TrimSpace (names .NameClean (selection )), ".md" }, "" )
281+
278282 var mySpeaker model.Speaker
279- mySpeaker , err = GetSpeakerInfo (selection , city , year )
283+ mySpeaker , err = GetSpeakerInfo (speakerFileName , city , year )
284+ fmt .Println ()
280285 color .Cyan ("+-+-+-+-+-+-+-+-+-+-+-+-+-+-+" )
281- fmt .Println ("Name is " + mySpeaker .Title )
286+ fmt .Fprintf (color .Output , "%s %s\n " , color .CyanString ("Name: " ), color .GreenString (mySpeaker .Title ))
287+
282288 if mySpeaker .Website != "" {
283- fmt .Println ( "Website is " + mySpeaker .Website )
289+ fmt .Fprintf ( color . Output , "%s %s \n " , color . CyanString ( "WebsiteName: " ), color . GreenString ( mySpeaker .Website ) )
284290 }
285291 if mySpeaker .Twitter != "" {
286- fmt .Println ( " Twitter is @" + mySpeaker .Twitter )
292+ fmt .Fprintf ( color . Output , "%s %s \n " , color . CyanString ( " Twitter: " ), color . GreenString ( fmt . Sprintf ( "@%s" , mySpeaker .Twitter )) )
287293 }
288294 if mySpeaker .Facebook != "" {
289- fmt .Println ( "Facebook is " + mySpeaker .Facebook )
295+ fmt .Fprintf ( color . Output , "%s %s \n " , color . CyanString ( "Facebook: " ), color . GreenString ( mySpeaker .Facebook ) )
290296 }
291297 if mySpeaker .Linkedin != "" {
292- fmt .Println ( "Website is " + mySpeaker .Linkedin )
298+ fmt .Fprintf ( color . Output , "%s %s \n " , color . CyanString ( "LinkedIn: " ), color . GreenString ( mySpeaker .Linkedin ) )
293299 }
294300 if mySpeaker .Github != "" {
295- fmt .Println ( "Github is @" + mySpeaker .Github )
301+ fmt .Fprintf ( color . Output , "%s %s \n " , color . CyanString ( "GitHub: " ), color . GreenString ( mySpeaker .Github ) )
296302 }
297303 if mySpeaker .Gitlab != "" {
298- fmt .Println ( "Gitlab is " + mySpeaker .Gitlab )
304+ fmt .Fprintf ( color . Output , "%s %s \n " , color . CyanString ( "GitLab: " ), color . GreenString ( mySpeaker .Gitlab ) )
299305 }
300306 if mySpeaker .Bio != "" {
301- fmt .Println ( "Bio is " + mySpeaker .Bio )
307+ fmt .Fprintf ( color . Output , "%s %s \n " , color . CyanString ( "Bio: " ), color . GreenString ( mySpeaker .Bio ) )
302308 }
303309 color .Cyan ("+-+-+-+-+-+-+-+-+-+-+-+-+-+-+" )
310+ fmt .Println ()
311+ }
312+ return
313+ }
314+
315+ func listSpeakerNames (speakers []string , city string , year string ) (speakerFullNames []string , err error ) {
316+ for _ , f := range speakers {
317+ var mySpeaker model.Speaker
318+ mySpeaker , err = GetSpeakerInfo (f , city , year )
319+ speakerFullNames = append (speakerFullNames , mySpeaker .Title )
304320 }
305321 return
306322}
0 commit comments