github.com/catandhorse/git-lfs@v2.5.2+incompatible/commands/command_uninstall.go (about)

     1  package commands
     2  
     3  import (
     4  	"github.com/spf13/cobra"
     5  )
     6  
     7  // uninstallCmd removes any configuration and hooks set by Git LFS.
     8  func uninstallCommand(cmd *cobra.Command, args []string) {
     9  	if err := cmdInstallOptions().Uninstall(); err != nil {
    10  		Error(err.Error())
    11  	}
    12  
    13  	if localInstall || cfg.InRepo() {
    14  		uninstallHooksCommand(cmd, args)
    15  	}
    16  
    17  	if !localInstall {
    18  		Print("Global Git LFS configuration has been removed.")
    19  	}
    20  }
    21  
    22  // uninstallHooksCmd removes any hooks created by Git LFS.
    23  func uninstallHooksCommand(cmd *cobra.Command, args []string) {
    24  	if err := uninstallHooks(); err != nil {
    25  		Error(err.Error())
    26  	}
    27  
    28  	Print("Hooks for this repository have been removed.")
    29  }
    30  
    31  func init() {
    32  	RegisterCommand("uninstall", uninstallCommand, func(cmd *cobra.Command) {
    33  		cmd.Flags().BoolVarP(&localInstall, "local", "l", false, "Set the Git LFS config for the local Git repository only.")
    34  		cmd.Flags().BoolVarP(&systemInstall, "system", "", false, "Set the Git LFS config in system-wide scope.")
    35  		cmd.AddCommand(NewCommand("hooks", uninstallHooksCommand))
    36  	})
    37  }