func (ag *AptGet) setPackages(args haiconf.CommandArgs) error { pl, _ := haiconf.CheckStringList("Packages", args) if len(pl) > 0 { ag.Packages = stringutils.RemoveDuplicates(pl) return nil } pfs, _ := haiconf.CheckAbsolutePath("PackagesFromSource", args) if pfs != "" { buff, err := ioutil.ReadFile(pfs) if err != nil { return err } nlSplit := func(r rune) bool { if r == '\n' { return true } return false } pkgs := strings.FieldsFunc(string(buff), nlSplit) ag.Packages = stringutils.RemoveDuplicates(pkgs) return nil } msg := "You must provide a value for either Packages or PackagesFromSource" return haiconf.NewArgError(msg, args) }
func (f *File) setSource(args haiconf.CommandArgs) error { src, err := haiconf.CheckAbsolutePath("Source", args) if err != nil { return err } f.Source = src return nil }
func (f *File) setPath(args haiconf.CommandArgs) error { p, err := haiconf.CheckAbsolutePath("Path", args) if err != nil { return err } f.Path = p return nil }
func (d *Directory) setPath(args haiconf.CommandArgs) error { p, err := haiconf.CheckAbsolutePath("Path", args) if err != nil { return err } d.Path = p return nil }