// FromConfig creates the struct representation of a step showing a checklist
FromConfig creates the struct representation of a step showing a checklist
// FromConfig creates the struct representation of a step showing a checklist
func (checklist *Checklist) FromConfig(configYaml map[string]interface{}) error {
	checklist.Kind = KindChecklist
	if description, ok := configYaml["Description"]; ok {
		checklist.Description = description.(string)
	}
	preferencesYaml := configYaml["Preferences"].(map[string]interface{})
	if message, ok := preferencesYaml["Message"].(string); ok {
		checklist.Message = message
	}
	if items, ok := preferencesYaml["Items"].([]interface{}); ok {
		for _, item := range items {
			if item, ok := item.(string); ok {
				checklist.Items = append(checklist.Items, item)
			} else {
				return fmt.Errorf("items in checklist must be of type string")
			}
		}
	} else {
		return fmt.Errorf("empty checklist found")
	}
	return nil
}
func ( checklist * Checklist ) FromConfig ( configYaml map [ string ] interface { } ) error { checklist . Kind = KindChecklist if description , ok := configYaml [ " " ] ; ok { checklist . Description = description . ( string ) } preferencesYaml := configYaml [ " " ] . ( map [ string ] interface { } ) if message , ok := preferencesYaml [ " " ] . ( string ) ; ok { checklist . Message = message } if items , ok := preferencesYaml [ " " ] . ( [ ] interface { } ) ; ok { for _ , item := range items { if item , ok := item . ( string ) ; ok { checklist . Items = append ( checklist . Items , item ) } else { return fmt . Errorf ( " " ) } } } else { return fmt . Errorf ( " " ) } return nil }
FromConfig creates the struct representation of a step showing a checklist
FromConfig creates the struct representation of a step showing a checklist