Beispiel #1
0
func (ag *AptGet) setMethod(args haiconf.CommandArgs) error {
	m, err := haiconf.CheckStringChoice("Method", args, availableMethods)

	if err != nil {
		return err
	}

	ag.Method = m

	return nil
}
Beispiel #2
0
func (c *Cron) checkPredefined(schedule map[string]string) (string, error) {
	var chosen string

	predefined, present := schedule["Predefined"]
	if !present {
		return chosen, nil
	}

	predef := haiconf.CommandArgs{
		"Predefined": predefined,
	}

	var keywords []string
	for k, _ := range PREDEFINED_SCHEDULES {
		keywords = append(keywords, k)
	}

	chosen, err := haiconf.CheckStringChoice("Predefined", predef, keywords)
	if err != nil {
		return "", err
	}

	return chosen, nil
}