Skip to content

Commit

Permalink
Add arg check
Browse files Browse the repository at this point in the history
  • Loading branch information
Zusier committed Nov 21, 2021
1 parent d7463ee commit f0f5392
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion multichoice/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ var outputChoices []string
func main() {
log.SetFlags(log.LstdFlags | log.Lshortfile)
argsWithoutProg := os.Args[1:]

if len(argsWithoutProg) != 3 {
log.Println("Usage: multichoice Title Prompt Choices;here")
os.Exit(1)
}
title := argsWithoutProg[0]
prompt := argsWithoutProg[1]
inputChoices = strings.Split(argsWithoutProg[2], ";")
Expand Down

0 comments on commit f0f5392

Please sign in to comment.