github.com/trevoraustin/hub@v2.2.0-preview1.0.20141105230840-96d8bfc654cc+incompatible/commands/selfupdate.go (about)

     1  package commands
     2  
     3  import (
     4  	"os"
     5  
     6  	"github.com/github/hub/utils"
     7  )
     8  
     9  var cmdSelfupdate = &Command{
    10  	Run:   update,
    11  	Usage: "selfupdate",
    12  	Short: "Update Hub",
    13  	Long: `Update Hub to the latest version.
    14  
    15  Examples:
    16    git selfupdate
    17  `,
    18  }
    19  
    20  func init() {
    21  	CmdRunner.Use(cmdSelfupdate)
    22  }
    23  
    24  func update(cmd *Command, args *Args) {
    25  	updater := NewUpdater()
    26  	err := updater.Update()
    27  	utils.Check(err)
    28  	os.Exit(0)
    29  }