22 lines
		
	
	
		
			553 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			553 B
		
	
	
	
		
			Go
		
	
	
	
	
	
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)
 | 
						|
}
 |