working on initing a repo, more work on 'add' command

This commit is contained in:
2020-05-27 22:54:02 -04:00
parent 2d743d17c3
commit 9b017f3128
8 changed files with 93 additions and 30 deletions

View File

@@ -3,6 +3,8 @@ package clientcmd
import (
"fmt"
"os"
clientconfig "github.com/deranjer/gvc/client/clientconfig"
)
//AddFiles adds files to the repo, inputType specifies file, folder, wildcard or all
@@ -10,3 +12,9 @@ func AddFiles(input string, inputType string) error {
fmt.Println("File/folder/wildcard to add", os.Args[2])
return nil
}
// AddRemote adds a remote to the config file
func AddRemote(name string, host string, port int, conf *clientconfig.Gvcconfig) error {
fmt.Println("name: ", name, "host: ", host, "port: ", port)
return nil
}

View File

@@ -1 +1,4 @@
package clientcmd
// ConfigPath is the global path to the config that is injected from the main client package.
var ConfigPath string

View File

@@ -2,15 +2,19 @@ package clientcmd
import (
"fmt"
"log"
"os"
)
//AddFiles adds files to the repo
func InitializeRepo() error {
// InitializeRepo creates the repo directory and a new config file
func InitializeRepo() {
cwd, err := os.Getwd()
if err != nil {
return err
log.Fatal("unable to get current working directory.. permissions issue?")
}
fmt.Println("Initializing repo in dir: ", cwd)
return nil
err = os.Mkdir(".gvc", 0644)
if err != nil {
fmt.Println(".gvc directory already exists, but no config file... continuing")
}
}