Commit df2890d
Changed files (1)
command.go
@@ -205,6 +205,31 @@ func parseTestCommandFlags(command Command) (int, bool, error) {
return questions, useBlueprint, err
}
+// buildBluePrint creates an array of categories the user selects
+func buildBluePrint(useBlueprint bool) (string, error) {
+ if !useBlueprint {
+ return "", nil
+ }
+ var blueprint string
+ fmt.Print("Categories\n----------\n")
+ for i := 0; i < len(categoryKeys)-1; i += 2 {
+ fmt.Printf("%d) %-15s\t%d) %-15s\n", i, categoryKeys[i], i+1, categoryKeys[i+1])
+ }
+ fmt.Printf("Enter the category numbers, separated by a comma: ")
+ reader := bufio.NewReader(os.Stdin)
+ input, _ := reader.ReadString('\n')
+ splits := strings.Split(input, ",")
+ for _, split := range splits {
+ split = strings.TrimSpace(split)
+ if _, err := strconv.Atoi(split); err != nil {
+ return "", err
+ } else {
+ blueprint = blueprint + "-" + split
+ }
+ }
+ return blueprint, nil
+}
+
// executeTest runs a user through a test
// from retrieving the records to returning the answers
func executeTest(command Command) error {