diff --git a/cmd/init.go b/cmd/init.go index 93e4d01..84a2770 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -60,6 +60,7 @@ var initCommand = &cobra.Command { log.Fatal("path needs trailing slash") } + // TODO make a configurable list of binaries we want to look for var programs []string var acceptedprograms [3] string acceptedprograms[0] = "nvim" diff --git a/tools/copy.go b/tools/copy.go index ed5cd71..e4773c6 100644 --- a/tools/copy.go +++ b/tools/copy.go @@ -4,12 +4,18 @@ import ( "fmt" "io" "path/filepath" + "strings" "github.com/spf13/afero" ) func CopyFile(os afero.Fs, srcFile, destFile string) error{ // helper function to copy files over + // ignore pre-existing git files + if strings.Contains(srcFile, ".git") { + return nil + } + sourceFileStat, err := os.Stat(srcFile) if err != nil { return err @@ -19,6 +25,7 @@ func CopyFile(os afero.Fs, srcFile, destFile string) error{ return fmt.Errorf("%s is not a regular file", srcFile) } + source, err := os.Open(srcFile) if err != nil { return err @@ -44,6 +51,9 @@ func CopyDir(os afero.Fs, srcDir, destDir string) error { for _, entry := range(entries) { if entry.IsDir() { + if entry.Name() == ".git" { + continue + } subDir := filepath.Join(srcDir, entry.Name()) destSubDir := filepath.Join(destDir, entry.Name()) err := os.MkdirAll(destSubDir, entry.Mode().Perm())