Skip to content

Commit 76ffed4

Browse files
author
A.A.Abroskin
committed
add force flag for install
1 parent f81e7c2 commit 76ffed4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cmd/install.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ var availableHooks = [...]string{
3636
}
3737

3838
var checkSumHook = "prepare-commit-msg"
39+
var force bool
3940

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

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

5456
// InstallCmdExecutor execute basic configuration
5557
func InstallCmdExecutor(args []string, fs afero.Fs) {
5658
if yes, _ := afero.Exists(fs, getConfigYamlPath()); yes {
57-
if !isConfigSync(fs) {
59+
if !isConfigSync(fs) || force {
5860
log.Println(au.Cyan("SYNCING"), au.Bold("lefthook.yml"))
5961
DeleteGitHooks(fs)
6062
AddGitHooks(fs)

0 commit comments

Comments
 (0)