working on merging configs, adding branch/switch/pull commands

This commit is contained in:
2020-06-10 22:45:15 -04:00
parent c4aa5a1c66
commit 2cbdf21a81
12 changed files with 269 additions and 66 deletions

View File

@@ -0,0 +1,21 @@
package clientcmd
import (
"fmt"
clientconfig "github.com/deranjer/gvc/client/clientconfig"
)
// SwitchBranch switches to a different branch
func SwitchBranch(conf *clientconfig.Gvcconfig, branchName string) error {
fmt.Println("Attempting to switch to branch: ", branchName)
branches := conf.LocalBranches
for _, branch := range branches {
if branch == branchName {
fmt.Println("Found Branch: ", branch)
// TODO: do the actual branch switch
return nil
}
}
return fmt.Errorf("unable to locate requested branch: %s", branchName)
}