// makeBuild builds sources in the build subdir. // // Progress is sent to the update callback provided. // func (build *BuilderBase) makeBuild(dir string, progress func(float64)) error { jobs := strconv.Itoa(runtime.NumCPU()) build.log.Info("make", "-j", jobs) cmd := build.log.ExecCmd("make", "-j", jobs) cmd.Dir = dir lastvalue := 0 cmd.Stdout = linesplit.NewWriter(func(line string) { curvalue, curstr, text := trimInt(line) if curvalue > -1 { if curvalue > lastvalue { progress(float64(curvalue) / 100) lastvalue = curvalue } fmt.Printf("%s %s\n", curstr, color.Green(text)) } else { println(line) } }) e := cmd.Run() if e != nil { return e } return build.makeInstall(dir) }
// ListServices displays active services. // func (load *Manager) ListServices() (string, *dbus.Error) { list := make(map[string]int) for _, ref := range load.actives { list[ref.name]++ } str := "Cairo-Dock applets services: active " + strconv.Itoa(len(list)) + "/" + strconv.Itoa(len(cdtype.Applets)) for name := range cdtype.Applets { count := list[name] switch { case count > 1: str += "\n" + color.Green(" * ") + name + ":" + color.Green(strconv.Itoa(count)) case count == 1: str += "\n" + color.Green(" * ") + name default: str += "\n" + " " + name } } if len(load.actives) > len(list) { str += "\n" + "Total applets started: " + strconv.Itoa(len(load.actives)) } return str, nil }