From 10544e1c2d881a57435e1c28d4c657c14864d03d Mon Sep 17 00:00:00 2001 From: oscar Date: Sun, 21 Aug 2022 17:04:37 +1200 Subject: [PATCH] go(commands): add commands to list git branch --- go/commands/git.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 go/commands/git.go diff --git a/go/commands/git.go b/go/commands/git.go new file mode 100644 index 0000000..c4b8e5b --- /dev/null +++ b/go/commands/git.go @@ -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 +}