forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
image.go
49 lines (40 loc) · 1.27 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
46
47
48
49
package image
import (
"fmt"
"github.com/spf13/cobra"
ktemplates "k8s.io/kubernetes/pkg/kubectl/cmd/templates"
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions"
"github.com/openshift/origin/pkg/cmd/templates"
"github.com/openshift/origin/pkg/oc/cli/image/append"
"github.com/openshift/origin/pkg/oc/cli/image/extract"
"github.com/openshift/origin/pkg/oc/cli/image/mirror"
)
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 kcmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {
image := &cobra.Command{
Use: "image COMMAND",
Short: "Useful commands for managing images",
Long: imageLong,
Run: kcmdutil.DefaultSubCommandRun(streams.ErrOut),
}
name := fmt.Sprintf("%s image", fullName)
groups := ktemplates.CommandGroups{
{
Message: "Advanced commands:",
Commands: []*cobra.Command{
append.NewCmdAppendImage(name, streams),
extract.New(name, streams),
mirror.NewCmdMirrorImage(name, streams),
},
},
}
groups.Add(image)
templates.ActsAsRootCommand(image, []string{"options"}, groups...)
return image
}