forked from rhd-gitops-example/odo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
44 lines (35 loc) · 1.45 KB
/
config.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
package config
import (
"fmt"
"github.com/openshift/odo/pkg/config"
"github.com/openshift/odo/pkg/odo/util"
"github.com/spf13/cobra"
ktemplates "k8s.io/kubernetes/pkg/kubectl/cmd/templates"
)
// RecommendedCommandName is the recommended config command name
const RecommendedCommandName = "config"
var configLongDesc = ktemplates.LongDesc(`Modifies odo specific configuration settings within the config file.
%[1]s
`)
// NewCmdConfiguration implements the utils config odo command
func NewCmdConfiguration(name, fullName string) *cobra.Command {
configurationViewCmd := NewCmdView(viewCommandName, util.GetFullName(fullName, viewCommandName))
configurationSetCmd := NewCmdSet(setCommandName, util.GetFullName(fullName, setCommandName))
configurationUnsetCmd := NewCmdUnset(unsetCommandName, util.GetFullName(fullName, unsetCommandName))
configurationCmd := &cobra.Command{
Use: name,
Short: "Change or view configuration",
Long: fmt.Sprintf(configLongDesc, config.FormatLocallySupportedParameters()),
Example: fmt.Sprintf("%s\n%s\n%s",
configurationViewCmd.Example,
configurationSetCmd.Example,
configurationUnsetCmd.Example,
),
Aliases: []string{"configuration"},
}
configurationCmd.AddCommand(configurationViewCmd, configurationSetCmd)
configurationCmd.AddCommand(configurationUnsetCmd)
configurationCmd.SetUsageTemplate(util.CmdUsageTemplate)
configurationCmd.Annotations = map[string]string{"command": "main"}
return configurationCmd
}