forked from openshift/origin
/
set.go
51 lines (43 loc) · 1.2 KB
/
set.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
package set
import (
"fmt"
"io"
"github.com/spf13/cobra"
"github.com/openshift/origin/pkg/cmd/templates"
cmdutil "github.com/openshift/origin/pkg/cmd/util"
"github.com/openshift/origin/pkg/cmd/util/clientcmd"
)
const (
setLong = `
Configure application resources
These commands help you make changes to existing application resources.`
)
// NewCmdSet exposes commands for modifying objects.
func NewCmdSet(fullName string, f *clientcmd.Factory, in io.Reader, out, errout io.Writer) *cobra.Command {
set := &cobra.Command{
Use: "set COMMAND",
Short: "Commands that help set specific features on objects",
Long: setLong,
Run: cmdutil.DefaultSubCommandRun(out),
}
name := fmt.Sprintf("%s set", fullName)
groups := templates.CommandGroups{
{
Message: "Replication controllers, deployments, and daemon sets:",
Commands: []*cobra.Command{
NewCmdEnv(name, f, in, out),
NewCmdVolume(name, f, out, errout),
NewCmdProbe(name, f, out, errout),
},
},
{
Message: "Manage application flows:",
Commands: []*cobra.Command{
NewCmdTriggers(name, f, out, errout),
},
},
}
groups.Add(set)
templates.ActsAsRootCommand(set, []string{"options"}, groups...)
return set
}