github.com/BIG5Concepts/forego@v0.16.1/update.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/ddollar/forego/Godeps/_workspace/src/github.com/ddollar/dist"
     6  )
     7  
     8  var cmdUpdate = &Command{
     9  	Run:   runUpdate,
    10  	Usage: "update",
    11  	Short: "Update forego",
    12  	Long: `
    13  Update forego
    14  
    15  Examples:
    16  
    17  	forego update
    18  `,
    19  }
    20  
    21  func init() {
    22  }
    23  
    24  func runUpdate(cmd *Command, args []string) {
    25  	if Version == "dev" {
    26  		fmt.Println("ERROR: can't update dev version")
    27  		return
    28  	}
    29  	d := dist.NewDist("ddollar/forego", Version)
    30  	to, err := d.Update()
    31  	if err != nil {
    32  		fmt.Printf("ERROR: %s\n", err)
    33  	} else {
    34  		fmt.Printf("updated to %s\n", to)
    35  	}
    36  }