forked from ForceCLI/force
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.go
More file actions
44 lines (38 loc) · 706 Bytes
/
update.go
File metadata and controls
44 lines (38 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"fmt"
"github.com/ddollar/dist"
)
var cmdUpdate = &Command{
Run: runUpdate,
Usage: "update",
Short: "Update to the latest version",
Long: `
Update to the latest version
Examples:
force update
`,
}
func init() {
}
func runUpdate(cmd *Command, args []string) {
d := dist.NewDist("heroku/force", Version)
if len(args) == 1 {
err := d.FullUpdate(args[0])
if err != nil {
ErrorAndExit(err.Error())
} else {
fmt.Printf("updated to %s\n", args[0])
}
} else {
if Version == "dev" {
ErrorAndExit("can't update dev version")
}
to, err := d.Update()
if err != nil {
ErrorAndExit(err.Error())
} else {
fmt.Printf("updated to %s\n", to)
}
}
}