Skip to content

Commit

Permalink
add force flag for install
Browse files Browse the repository at this point in the history
  • Loading branch information
A.A.Abroskin committed Jul 12, 2019
1 parent f81e7c2 commit 76ffed4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ var availableHooks = [...]string{
}

var checkSumHook = "prepare-commit-msg"
var force bool

var installCmd = &cobra.Command{
Use: "install",
Expand All @@ -48,13 +49,14 @@ var installCmd = &cobra.Command{
var appFs = afero.NewOsFs()

func init() {
rootCmd.PersistentFlags().BoolVarP(&force, "force", "f", false, "reinstall hooks without checking config version")
rootCmd.AddCommand(installCmd)
}

// InstallCmdExecutor execute basic configuration
func InstallCmdExecutor(args []string, fs afero.Fs) {
if yes, _ := afero.Exists(fs, getConfigYamlPath()); yes {
if !isConfigSync(fs) {
if !isConfigSync(fs) || force {
log.Println(au.Cyan("SYNCING"), au.Bold("lefthook.yml"))
DeleteGitHooks(fs)
AddGitHooks(fs)
Expand Down

0 comments on commit 76ffed4

Please sign in to comment.