25 lines
570 B
Go
25 lines
570 B
Go
package clientcmd
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
// InitializeRepo creates the repo directory and a new config file
|
|
func InitializeRepo() string {
|
|
cwd, err := os.Getwd()
|
|
if err != nil {
|
|
log.Fatal("unable to get current working directory.. permissions issue?")
|
|
}
|
|
fmt.Println("Initializing repo in dir: ", cwd)
|
|
err = os.Mkdir(".gvc", 0644)
|
|
if err != nil {
|
|
fmt.Println(".gvc directory already exists, but no config file... continuing")
|
|
}
|
|
repoName := filepath.Base(cwd)
|
|
fmt.Println("Adding new repo with name: ", repoName)
|
|
return repoName
|
|
}
|