diff --git a/backend/env/env.go b/backend/env/env.go index f6874d1..66c7295 100644 --- a/backend/env/env.go +++ b/backend/env/env.go @@ -26,6 +26,7 @@ import ( "os/exec" "os/user" "path/filepath" + "strings" "github.com/fatih/color" "github.com/spf13/afero" @@ -134,6 +135,15 @@ func EnsureDotfilesDir(dotfilesDirPath string) (err error) { // ImportIntoDotfilesDir moves dotfiles into dotfiles directory and create symlinks. func ImportIntoDotfilesDir(dotfilesToSave []string, dotfilesDirPath string) (err error) { usr, _ := user.Current() + + if len(dotfilesToSave) == 0 { + files, _ := ioutil.ReadDir(usr.HomeDir) + for _, file := range files { + if strings.HasPrefix(file.Name(), ".") && file.Name() != ".ssh" && file.Name() != ".bash_history" && file.Name() != ".Trash" { + dotfilesToSave = append(dotfilesToSave, file.Name()) + } + } + } for _, dotfileToSave := range dotfilesToSave { src := filepath.Join(usr.HomeDir, dotfileToSave) dst := filepath.Join(dotfilesDirPath, dotfileToSave) diff --git a/cmd/env.go b/cmd/env.go index ecc8158..dcdab75 100644 --- a/cmd/env.go +++ b/cmd/env.go @@ -221,7 +221,7 @@ var envSaveCmd = &cobra.Command{ config.DotfilesDirPath, config.Vipers["config"].GetStringMapString("dotfiles")["repository"], config.Vipers["config"].GetString("default_save_message"), - []string{".testong"}, + []string{}, ) if err != nil { fmt.Fprintf(os.Stderr, "Save command failed: %s", err)