forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
registry.go
47 lines (39 loc) · 1.22 KB
/
registry.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
package registry
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/registry/info"
"github.com/openshift/origin/pkg/oc/cli/cmd/registry/login"
"github.com/openshift/origin/pkg/oc/cli/util/clientcmd"
)
var (
imageLong = ktemplates.LongDesc(`
Manage the integrated registry on OpenShift
These commands help you work with an integrated OpenShift registry.`)
)
// NewCmd exposes commands for working with the registry.
func NewCmd(fullName string, f *clientcmd.Factory, in io.Reader, out, errout io.Writer) *cobra.Command {
image := &cobra.Command{
Use: "registry COMMAND",
Short: "Commands for working with the registry",
Long: imageLong,
Run: cmdutil.DefaultSubCommandRun(errout),
}
name := fmt.Sprintf("%s registry", fullName)
groups := ktemplates.CommandGroups{
{
Message: "Advanced commands:",
Commands: []*cobra.Command{
info.New(name, f, out, errout),
login.New(name, f, out, errout),
},
},
}
groups.Add(image)
templates.ActsAsRootCommand(image, []string{"options"}, groups...)
return image
}