forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
image.go
45 lines (37 loc) · 1.1 KB
/
image.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
package image
import (
"fmt"
"io"
"github.com/spf13/cobra"
ktemplates "k8s.io/kubernetes/pkg/kubectl/cmd/templates"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"github.com/openshift/origin/pkg/cmd/templates"
"github.com/openshift/origin/pkg/oc/cli/cmd/image/mirror"
"github.com/openshift/origin/pkg/oc/cli/util/clientcmd"
)
var (
imageLong = ktemplates.LongDesc(`
Manage images on OpenShift
These commands help you manage images on OpenShift.`)
)
// NewCmdImage exposes commands for modifying images.
func NewCmdImage(fullName string, f *clientcmd.Factory, in io.Reader, out, errout io.Writer) *cobra.Command {
image := &cobra.Command{
Use: "image COMMAND",
Short: "Useful commands for managing images",
Long: imageLong,
Run: cmdutil.DefaultSubCommandRun(errout),
}
name := fmt.Sprintf("%s image", fullName)
groups := ktemplates.CommandGroups{
{
Message: "Advanced commands:",
Commands: []*cobra.Command{
mirror.NewCmdMirrorImage(name, out, errout),
},
},
}
groups.Add(image)
templates.ActsAsRootCommand(image, []string{"options"}, groups...)
return image
}