-
Notifications
You must be signed in to change notification settings - Fork 72
/
profile.go
38 lines (29 loc) · 911 Bytes
/
profile.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
// This file contains functions that help to manage visibility of early stage commands
package profile
import (
"os"
"strconv"
"github.com/spf13/cobra"
)
const DevPreviewEnv = "RHOAS_DEV"
// ApplyDevPreviewLabel adds visual element displayed in help
func ApplyDevPreviewLabel(cmd *cobra.Command) {
cmd.Short = "[beta] " + cmd.Short
cmd.Long += "\nThis command is available as part of the Development Preview release.\n"
for _, child := range cmd.Commands() {
ApplyDevPreviewLabel(child)
}
}
// DevPreviewAnnotation used in templates and tools like documentation generation
func DevPreviewAnnotation() map[string]string {
return map[string]string{"channel": "preview"}
}
// DevModeEnabled Check if development mode is enabled
func DevModeEnabled() bool {
rawEnvVal := os.Getenv(DevPreviewEnv)
boolVal, err := strconv.ParseBool(rawEnvVal)
if err != nil {
return false
}
return boolVal
}