-
Notifications
You must be signed in to change notification settings - Fork 1
/
macos.go
61 lines (53 loc) · 1 KB
/
macos.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package cask
import "fmt"
// A MacOS represents the available macOS versions.
type MacOS int
// Different macOS releases.
const (
MacOSHighSierra MacOS = iota
MacOSSierra
MacOSElCapitan
MacOSYosemite
MacOSMavericks
MacOSMountainLion
MacOSLion
MacOSSnowLeopard
MacOSLeopard
MacOSTiger
)
var macOSNames = [...]string{
"macOS High Sierra",
"macOS Sierra",
"OS X El Capitan",
"OS X Yosemite",
"OS X Mavericks",
"OS X Mountain Lion",
"OS X Lion",
"Mac OS X Snow Leopard",
"Mac OS X Leopard",
"Mac OS X Tiger",
}
var macOSVersion = [...]string{
"10.13",
"10.12",
"10.11",
"10.10",
"10.9",
"10.8",
"10.7",
"10.6",
"10.5",
"10.4",
}
// Name returns the MacOS release name.
func (m MacOS) Name() string {
return macOSNames[m]
}
// Version returns the MacOS release version.
func (m MacOS) Version() string {
return macOSVersion[m]
}
// String returns the string representation of the MacOS release.
func (m MacOS) String() string {
return fmt.Sprintf("%s (%s)", macOSNames[m], macOSVersion[m])
}