2015-11-16 20:37:08 +00:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/github/git-lfs/lfs"
|
2016-05-23 18:02:27 +00:00
|
|
|
"github.com/spf13/cobra"
|
2015-11-16 20:37:08 +00:00
|
|
|
)
|
|
|
|
|
2016-08-10 15:33:25 +00:00
|
|
|
// uninstallCmd removes any configuration and hooks set by Git LFS.
|
2015-11-16 20:37:08 +00:00
|
|
|
func uninstallCommand(cmd *cobra.Command, args []string) {
|
|
|
|
if err := lfs.UninstallFilters(); err != nil {
|
|
|
|
Error(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
Print("Global Git LFS configuration has been removed.")
|
|
|
|
|
|
|
|
if lfs.InRepo() {
|
|
|
|
uninstallHooksCommand(cmd, args)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-10 15:33:25 +00:00
|
|
|
// uninstallHooksCmd removes any hooks created by Git LFS.
|
2015-11-16 20:37:08 +00:00
|
|
|
func uninstallHooksCommand(cmd *cobra.Command, args []string) {
|
|
|
|
if err := lfs.UninstallHooks(); err != nil {
|
|
|
|
Error(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
Print("Hooks for this repository have been removed.")
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2016-08-10 15:33:25 +00:00
|
|
|
RegisterSubcommand(func() *cobra.Command {
|
|
|
|
cmd := &cobra.Command{
|
|
|
|
Use: "uninstall",
|
|
|
|
Run: uninstallCommand,
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd.AddCommand(&cobra.Command{
|
|
|
|
Use: "hooks",
|
|
|
|
Run: uninstallHooksCommand,
|
|
|
|
})
|
|
|
|
return cmd
|
|
|
|
})
|
2015-11-16 20:37:08 +00:00
|
|
|
}
|