|
|
|
|
@ -14,7 +14,6 @@ import (
|
|
|
|
|
"github.com/spf13/viper"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
RootCmd.AddCommand(initCommand)
|
|
|
|
|
}
|
|
|
|
|
@ -24,7 +23,7 @@ func copyExistingConfigs(programs []string, fs afero.Fs) {
|
|
|
|
|
destRoot := DotfilePath
|
|
|
|
|
|
|
|
|
|
configRoot := ConfigPath
|
|
|
|
|
for _, program := range(programs) {
|
|
|
|
|
for _, program := range programs {
|
|
|
|
|
// TODO: do something here
|
|
|
|
|
err := tools.CopyDir(fs, filepath.Join(configRoot, program), filepath.Join(destRoot, program))
|
|
|
|
|
if err != nil {
|
|
|
|
|
@ -37,7 +36,7 @@ func createDotfileStructure(programs []string, fs afero.Fs) {
|
|
|
|
|
// takes list of programs and creates dotfiles for them
|
|
|
|
|
dotfileRoot := DotfilePath
|
|
|
|
|
fmt.Printf("creating dotfile directory structure at %s\n", dotfileRoot)
|
|
|
|
|
for _, program := range(programs) {
|
|
|
|
|
for _, program := range programs {
|
|
|
|
|
if err := fs.MkdirAll(path.Join(dotfileRoot, program), os.ModePerm); err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
@ -58,7 +57,7 @@ func runInitCommand(cmd *cobra.Command, args []string) {
|
|
|
|
|
testing := viper.GetBool("testing")
|
|
|
|
|
viper.AddConfigPath(filepath.Join(DotfilePath, "dotctl"))
|
|
|
|
|
|
|
|
|
|
if(viper.Get("testing") == true && fs.Name() != "MemMapFS") {
|
|
|
|
|
if viper.Get("testing") == true && fs.Name() != "MemMapFS" {
|
|
|
|
|
log.Fatalf("wrong filesystem, got %s", fs.Name())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|