Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 10 additions & 0 deletions tools/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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())
Expand Down