working on merging configs, adding branch/switch/pull commands
This commit is contained in:
21
client/clientcmd/switch.go
Normal file
21
client/clientcmd/switch.go
Normal 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)
|
||||
}
|
Reference in New Issue
Block a user