Skip to content

Commit

Permalink
Semi-working install
Browse files Browse the repository at this point in the history
  • Loading branch information
evanpurkhiser committed Jul 14, 2019
1 parent e0bdc0a commit 97039fc
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions cmd/dots/install.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package main

import (
"fmt"

"github.com/spf13/cobra"

"go.evanpurkhiser.com/dots/installer"
Expand All @@ -13,10 +11,24 @@ var installCmd = cobra.Command{
Use: "install [filter...]",
Short: "Install and compile dotfiles from sources",
RunE: func(cmd *cobra.Command, args []string) error {
forceReInstall, _ := cmd.Flags().GetBool("reinstall")
dryRun, _ := cmd.Flags().GetBool("dry-run")

dotfiles := resolver.ResolveDotfiles(*sourceConfig, *sourceLockfile).Filter(args)
prepared := installer.PrepareDotfiles(dotfiles, *sourceConfig)

fmt.Println(prepared)
if dryRun {
// TODO: Do logging output
return nil
}

config := installer.InstallConfig{
SourceConfig: sourceConfig,
ForceReinstall: forceReInstall,
}

installer.InstallDotfiles(prepared, config)
installer.RunInstallScripts(prepared, config)

return nil
},
Expand All @@ -27,7 +39,7 @@ func init() {
flags := installCmd.Flags()
flags.SortFlags = false

flags.BoolP("reinstall", "r", false, "reinstall all dotfiles, includes unchanged files")
flags.BoolP("reinstall", "r", false, "forces execution of all installation scripts")
flags.BoolP("dry-run", "n", false, "do not mutate any dotfiles, implies info")
flags.BoolP("info", "i", false, "prints install operation details")
flags.BoolP("verbose", "v", false, "prints debug data, implies info")
Expand Down

0 comments on commit 97039fc

Please sign in to comment.