Example #1
0
func execute(path string, vcs string, vcs_verb string) {
	if vcs_verb == "" {
		return
	}
	a := func(wd string, vcs string, vcs_verb string, seq bool) {
		msg := "=== @{!" + vcs_color[vcs] + "} "
		msg += filepath.Base(path)
		msg += "@| (@!" + vcs + "@|) ==="
		var cmd exec.Cmd
		cmd.Dir = wd
		cmd.Args = strings.Split(vcs_verb, " ")
		path, err := exec.LookPath(cmd.Args[0])
		if err != nil {
			path = cmd.Args[0]
		}
		cmd.Path = path
		out, err := cmd.CombinedOutput()
		if err != nil {
			br := color.Colorize("!r")
			rst := color.Colorize("|")
			fmt.Printf(color.Sprint(msg)+"\n%s\n%s%s%s\n\n", out, br, err, rst)
		} else {
			fmt.Printf(color.Sprint(msg)+"\n%s\n", out)
		}
		if !seq {
			quit <- 0
		}
	}
	if *sequential {
		a(path, vcs, vcs_verb, *sequential)
	} else {
		count += 1
		go a(path, vcs, vcs_verb, *sequential)
	}
}
Example #2
0
File: clog.go Project: kdar/clog
// Panicln is equivalent to Println() followed by a call to panic().
func Panicln(v ...interface{}) {
	s := color.Sprint(fmt.Sprintln(v...))
	std.Output(2, s)
	panic(s)
}
Example #3
0
File: clog.go Project: kdar/clog
// Fatalln is equivalent to Println() followed by a call to os.Exit(1).
func Fatalln(v ...interface{}) {
	std.Output(2, color.Sprint(fmt.Sprintln(v...)))
	os.Exit(1)
}
Example #4
0
File: clog.go Project: kdar/clog
// Panic is equivalent to Print() followed by a call to panic().
func Panic(v ...interface{}) {
	s := color.Sprint(v...)
	std.Output(2, s)
	panic(s)
}
Example #5
0
File: clog.go Project: kdar/clog
// Println calls Output to print to the standard logger.
// Arguments are handled in the manner of fmt.Println.
func Println(v ...interface{}) {
	std.Output(2, color.Sprint(fmt.Sprintln(v...)))
}