func Spawn(command string, args ...string) error { cmd := cmd.New("git") cmd.WithArg(command) for _, a := range args { cmd.WithArg(a) } return cmd.Exec() }
func Spawn(command string, args ...string) error { cmd := cmd.New("git") cmd.WithArg(command) for _, a := range args { cmd.WithArg(a) } out, err := cmd.ExecOutput() if err != nil { return errors.New(out) } return nil }
func Show(sha string) (string, error) { cmd := cmd.New("git") cmd.WithArg("show").WithArg("-s").WithArg("--format=%w(78,0,0)%s%n%+b").WithArg(sha) output, err := cmd.ExecOutput() output = strings.TrimSpace(output) return output, err }
func execGitCmd(input ...string) (outputs []string, err error) { cmd := cmd.New("git") for _, i := range input { cmd.WithArg(i) } out, err := cmd.ExecOutput() for _, line := range strings.Split(out, "\n") { outputs = append(outputs, string(line)) } return outputs, err }