sync

package
v0.0.0-...-0730a73 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2019 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package sync contains SyncCmd which downloads all global dot files to local machine.

Index

Constants

This section is empty.

Variables

View Source
var SyncCmd = &cobra.Command{
	Use:   "sync",
	Short: "Download all global dot files to local machine.",
	Long:  "Download all global dot files to local machine.",
	Run: func(cmd *cobra.Command, args []string) {
		answers := struct {
			Platform string
		}{}
		if err := survey.Ask(questions, &answers); err != nil {
			utils.ExitOnError(err)
		}
		usr, err := user.Current()
		if err != nil {
			utils.ExitOnError(err)
		}
		templates := []string{"dot/dotfiles"}
		requireMap := map[string]interface{}{
			"mac":     answers.Platform == "Mac",
			"linux":   answers.Platform == "Linux",
			"windows": answers.Platform == "Windows",
		}
		replaceMap := map[string]interface{}{
			"username": usr.Username,
			"mac":      answers.Platform == "Mac",
			"linux":    answers.Platform == "Linux",
			"windows":  answers.Platform == "Windows",
		}
		utils.GenerateFile(templates, usr.HomeDir, requireMap, replaceMap)
	},
}

SyncCmd downloads all global dot files to local machine.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL