forked from heroku/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion.go
43 lines (37 loc) · 774 Bytes
/
version.go
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
package main
import (
"fmt"
"runtime"
)
func init() {
CLITopics = append(CLITopics, &Topic{
Name: "version",
Hidden: true,
Commands: Commands{
{
Topic: "version",
Description: "print the version",
Hidden: true,
DisableAnalytics: true,
Help: `Shows the Heroku CLI version.
Example:
$ heroku version
heroku-cli/1.2.3 (x86_64-darwin11.2.0) ruby/1.9.3`,
Run: func(ctx *Context) {
ShowVersion()
},
},
},
})
}
func version() string {
return fmt.Sprintf("heroku-cli/%s (%s-%s) %s", Version, runtime.GOOS, runtime.GOARCH, runtime.Version())
}
// ShowVersion shows the version and exits
func ShowVersion() {
Printf(version())
if Channel != "stable" {
Printf(" %s", Channel)
}
Println()
}