git-lfs/commands/command_update.go

33 lines
743 B
Go
Raw Normal View History

package commands
import (
2015-03-19 19:30:55 +00:00
"github.com/github/git-lfs/lfs"
2015-05-25 18:20:50 +00:00
"github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra"
)
var (
updateCmd = &cobra.Command{
Use: "update",
2015-03-19 19:30:55 +00:00
Short: "Update local Git LFS configuration",
Run: updateCommand,
}
updateForce = false
)
2015-03-19 19:30:55 +00:00
// updateCommand is used for updating parts of Git LFS that reside under
// .git/lfs.
func updateCommand(cmd *cobra.Command, args []string) {
if err := lfs.InstallHooks(updateForce); err != nil {
Error(err.Error())
Print("Run `git lfs update --force` to overwrite this hook.")
} else {
Print("Updated pre-push hook.")
}
}
func init() {
updateCmd.Flags().BoolVarP(&updateForce, "force", "f", false, "Overwrite hooks.")
RootCmd.AddCommand(updateCmd)
}