...
1 package preference
2
3 import (
4 "context"
5 "fmt"
6
7 "github.com/redhat-developer/odo/pkg/odo/cli/preference/add"
8 "github.com/redhat-developer/odo/pkg/odo/cli/preference/remove"
9 "github.com/redhat-developer/odo/pkg/odo/genericclioptions/clientset"
10 "github.com/redhat-developer/odo/pkg/odo/util"
11 "github.com/redhat-developer/odo/pkg/preference"
12
13 "github.com/spf13/cobra"
14 ktemplates "k8s.io/kubectl/pkg/util/templates"
15 )
16
17
18 const RecommendedCommandName = "preference"
19
20 var preferenceLongDesc = ktemplates.LongDesc(`Modifies odo specific configuration settings within the global preference file.
21
22 %[1]s`)
23
24
25 func NewCmdPreference(ctx context.Context, name, fullName string, testClientset clientset.Clientset) *cobra.Command {
26
27
28 preferenceViewCmd := NewCmdView(viewCommandName, util.GetFullName(fullName, viewCommandName), testClientset)
29 preferenceSetCmd := NewCmdSet(ctx, setCommandName, util.GetFullName(fullName, setCommandName), testClientset)
30 preferenceUnsetCmd := NewCmdUnset(unsetCommandName, util.GetFullName(fullName, unsetCommandName), testClientset)
31 preferenceAddCmd := add.NewCmdAdd(add.RecommendedCommandName, util.GetFullName(fullName, add.RecommendedCommandName), testClientset)
32 preferenceRemoveCmd := remove.NewCmdRemove(remove.RecommendedCommandName, util.GetFullName(fullName, remove.RecommendedCommandName), testClientset)
33
34
35
36
37 preferenceCmd := &cobra.Command{
38 Use: name,
39 Short: "Modifies preference settings",
40 Long: fmt.Sprintf(preferenceLongDesc, preference.FormatSupportedParameters()),
41 Example: fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n",
42 preferenceViewCmd.Example,
43 preferenceSetCmd.Example,
44 preferenceUnsetCmd.Example,
45 preferenceAddCmd.Example,
46 preferenceRemoveCmd.Example,
47 ),
48 }
49
50
51 preferenceCmd.AddCommand(preferenceViewCmd, preferenceSetCmd, preferenceUnsetCmd, preferenceAddCmd, preferenceRemoveCmd)
52 preferenceCmd.SetUsageTemplate(util.CmdUsageTemplate)
53 util.SetCommandGroup(preferenceCmd, util.UtilityGroup)
54
55 return preferenceCmd
56 }
57
View as plain text