Example #1
0
func showBranch(path path, onlyDirty, quiet bool) error {
	branch, err := getCurrentBranch(path.linkTo, quiet)
	if err != nil {
		return hierr.Errorf(err, "error processing %s", path.path)
	}

	if branch == "master" {
		printClean(path, onlyDirty, branch)
	} else {
		printDirty(path, branch)
	}

	return nil
}
Example #2
0
File: utils.go Project: zazab/lsgs
func execute(dir string, quiet bool, commandLine ...string) (string, error) {
	cmd := exec.Command("git", commandLine...)
	cmd.Dir = dir
	if !quiet {
		cmd.Stderr = os.Stderr
	}

	out, err := cmd.Output()
	if err != nil {
		return "", hierr.Errorf(
			err, "can't run 'git %s' in '%s'",
			strings.Join(commandLine, " "), dir,
		)
	}

	return string(out), nil
}