github.com/stffabi/git-lfs@v2.3.5-0.20180214015214-8eeaa8d88902+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  	Print("Global Git LFS configuration has been removed.")
    18  }
    19  
    20  // uninstallHooksCmd removes any hooks created by Git LFS.
    21  func uninstallHooksCommand(cmd *cobra.Command, args []string) {
    22  	if err := uninstallHooks(); err != nil {
    23  		Error(err.Error())
    24  	}
    25  
    26  	Print("Hooks for this repository have been removed.")
    27  }
    28  
    29  func init() {
    30  	RegisterCommand("uninstall", uninstallCommand, func(cmd *cobra.Command) {
    31  		cmd.Flags().BoolVarP(&localInstall, "local", "l", false, "Set the Git LFS config for the local Git repository only.")
    32  		cmd.Flags().BoolVarP(&systemInstall, "system", "", false, "Set the Git LFS config in system-wide scope.")
    33  		cmd.AddCommand(NewCommand("hooks", uninstallHooksCommand))
    34  	})
    35  }