go(commands): add commands to list git branch

pull/7/head
oscar 2022-08-21 17:04:37 +12:00
parent 77cd6aac14
commit 10544e1c2d
1 changed files with 18 additions and 0 deletions

18
go/commands/git.go 100644
View File

@ -0,0 +1,18 @@
package commands
import (
"ocl/portainer-devtool/utils"
"os/exec"
)
func ListBranches(workdir string) error {
cmd := exec.Command("git", "branch")
cmd.Dir = workdir
out, err := cmd.Output()
if err != nil {
return err
}
utils.PrintOutput("Your current checkout branch", out)
return nil
}