Skip to content

Commit 57cde07

Browse files
committed
update default subcommand run func
This patch updates parent commands of sub-commands to exit with a usage error and exit code 1 on an invalid (non-sub-command) argument. It also upstreams the DefaultSubCommandRun util.
1 parent c64d401 commit 57cde07

File tree

25 files changed

+77
-93
lines changed

25 files changed

+77
-93
lines changed

pkg/cmd/admin/admin.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/spf13/cobra"
88

99
kubectl "k8s.io/kubernetes/pkg/kubectl/cmd"
10+
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
1011

1112
"github.com/openshift/origin/pkg/cmd/admin/cert"
1213
diagnostics "github.com/openshift/origin/pkg/cmd/admin/diagnostics"
@@ -43,7 +44,7 @@ func NewCommandAdmin(name, fullName string, in io.Reader, out io.Writer, errout
4344
Use: name,
4445
Short: "Tools for managing a cluster",
4546
Long: fmt.Sprintf(adminLong),
46-
Run: cmdutil.DefaultSubCommandRun(out),
47+
Run: kcmdutil.DefaultSubCommandRun(out),
4748
}
4849

4950
f := clientcmd.New(cmds.PersistentFlags())
@@ -62,7 +63,7 @@ func NewCommandAdmin(name, fullName string, in io.Reader, out io.Writer, errout
6263
Commands: []*cobra.Command{
6364
project.NewCmdNewProject(project.NewProjectRecommendedName, fullName+" "+project.NewProjectRecommendedName, f, out),
6465
policy.NewCmdPolicy(policy.PolicyRecommendedName, fullName+" "+policy.PolicyRecommendedName, f, out, errout),
65-
groups.NewCmdGroups(groups.GroupsRecommendedName, fullName+" "+groups.GroupsRecommendedName, f, out),
66+
groups.NewCmdGroups(groups.GroupsRecommendedName, fullName+" "+groups.GroupsRecommendedName, f, out, errout),
6667
cert.NewCmdCert(cert.CertRecommendedName, fullName+" "+cert.CertRecommendedName, out, errout),
6768
admin.NewCommandOverwriteBootstrapPolicy(admin.OverwriteBootstrapPolicyCommandName, fullName+" "+admin.OverwriteBootstrapPolicyCommandName, fullName+" "+admin.CreateBootstrapPolicyFileCommand, out),
6869
},
@@ -76,22 +77,22 @@ func NewCommandAdmin(name, fullName string, in io.Reader, out io.Writer, errout
7677
cmdutil.ReplaceCommandName("kubectl", fullName, templates.Normalize(kubectl.NewCmdUncordon(f.Factory, out))),
7778
cmdutil.ReplaceCommandName("kubectl", fullName, templates.Normalize(kubectl.NewCmdDrain(f.Factory, out))),
7879
cmdutil.ReplaceCommandName("kubectl", fullName, templates.Normalize(kubectl.NewCmdTaint(f.Factory, out))),
79-
network.NewCmdPodNetwork(network.PodNetworkCommandName, fullName+" "+network.PodNetworkCommandName, f, out),
80+
network.NewCmdPodNetwork(network.PodNetworkCommandName, fullName+" "+network.PodNetworkCommandName, f, out, errout),
8081
},
8182
},
8283
{
8384
Message: "Maintenance:",
8485
Commands: []*cobra.Command{
8586
diagnostics.NewCmdDiagnostics(diagnostics.DiagnosticsRecommendedName, fullName+" "+diagnostics.DiagnosticsRecommendedName, out),
86-
prune.NewCommandPrune(prune.PruneRecommendedName, fullName+" "+prune.PruneRecommendedName, f, out),
87+
prune.NewCommandPrune(prune.PruneRecommendedName, fullName+" "+prune.PruneRecommendedName, f, out, errout),
8788
buildchain.NewCmdBuildChain(name, fullName+" "+buildchain.BuildChainRecommendedCommandName, f, out),
8889
migrate.NewCommandMigrate(
89-
migrate.MigrateRecommendedName, fullName+" "+migrate.MigrateRecommendedName, f, out,
90+
migrate.MigrateRecommendedName, fullName+" "+migrate.MigrateRecommendedName, f, out, errout,
9091
// Migration commands
9192
migrateimages.NewCmdMigrateImageReferences("image-references", fullName+" "+migrate.MigrateRecommendedName+" image-references", f, in, out, errout),
9293
migratestorage.NewCmdMigrateAPIStorage("storage", fullName+" "+migrate.MigrateRecommendedName+" storage", f, in, out, errout),
9394
),
94-
top.NewCommandTop(top.TopRecommendedName, fullName+" "+top.TopRecommendedName, f, out),
95+
top.NewCommandTop(top.TopRecommendedName, fullName+" "+top.TopRecommendedName, f, out, errout),
9596
},
9697
},
9798
{
@@ -129,7 +130,7 @@ func NewCommandAdmin(name, fullName string, in io.Reader, out io.Writer, errout
129130

130131
cmds.AddCommand(
131132
// part of every root command
132-
cmd.NewCmdConfig(fullName, "config"),
133+
cmd.NewCmdConfig(fullName, "config", out, errout),
133134
cmd.NewCmdCompletion(fullName, f, out),
134135

135136
// hidden

pkg/cmd/admin/cert/cert.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"io"
55

66
"github.com/spf13/cobra"
7+
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
78

89
"github.com/openshift/origin/pkg/cmd/server/admin"
9-
"github.com/openshift/origin/pkg/cmd/util"
1010
)
1111

1212
const CertRecommendedName = "ca"
@@ -18,7 +18,7 @@ func NewCmdCert(name, fullName string, out io.Writer, errout io.Writer) *cobra.C
1818
Use: name,
1919
Short: "Manage certificates and keys",
2020
Long: `Manage certificates and keys`,
21-
Run: util.DefaultSubCommandRun(out),
21+
Run: cmdutil.DefaultSubCommandRun(errout),
2222
}
2323

2424
cmds.AddCommand(admin.NewCommandCreateMasterCerts(admin.CreateMasterCertsCommandName, fullName+" "+admin.CreateMasterCertsCommandName, out))

pkg/cmd/admin/groups/groups.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"io"
55

66
"github.com/spf13/cobra"
7+
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
78

89
"github.com/openshift/origin/pkg/cmd/admin/groups/sync/cli"
910
"github.com/openshift/origin/pkg/cmd/templates"
10-
cmdutil "github.com/openshift/origin/pkg/cmd/util"
1111
"github.com/openshift/origin/pkg/cmd/util/clientcmd"
1212
)
1313

@@ -18,13 +18,13 @@ var groupLong = templates.LongDesc(`
1818
1919
Groups are sets of users that can be used when describing policy.`)
2020

21-
func NewCmdGroups(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
21+
func NewCmdGroups(name, fullName string, f *clientcmd.Factory, out, errOut io.Writer) *cobra.Command {
2222
// Parent command to which all subcommands are added.
2323
cmds := &cobra.Command{
2424
Use: name,
2525
Short: "Manage groups",
2626
Long: groupLong,
27-
Run: cmdutil.DefaultSubCommandRun(out),
27+
Run: cmdutil.DefaultSubCommandRun(errOut),
2828
}
2929

3030
cmds.AddCommand(NewCmdNewGroup(NewGroupRecommendedName, fullName+" "+NewGroupRecommendedName, f, out))

pkg/cmd/admin/migrate/migrate.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"io"
55

66
"github.com/spf13/cobra"
7+
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
78

89
"github.com/openshift/origin/pkg/cmd/templates"
9-
cmdutil "github.com/openshift/origin/pkg/cmd/util"
1010
"github.com/openshift/origin/pkg/cmd/util/clientcmd"
1111
)
1212

@@ -17,13 +17,13 @@ var migrateLong = templates.LongDesc(`
1717
1818
These commands assist administrators in performing preventative maintenance on a cluster.`)
1919

20-
func NewCommandMigrate(name, fullName string, f *clientcmd.Factory, out io.Writer, cmds ...*cobra.Command) *cobra.Command {
20+
func NewCommandMigrate(name, fullName string, f *clientcmd.Factory, out, errOut io.Writer, cmds ...*cobra.Command) *cobra.Command {
2121
// Parent command to which all subcommands are added.
2222
cmd := &cobra.Command{
2323
Use: name,
2424
Short: "Migrate data in the cluster",
2525
Long: migrateLong,
26-
Run: cmdutil.DefaultSubCommandRun(out),
26+
Run: cmdutil.DefaultSubCommandRun(errOut),
2727
}
2828
cmd.AddCommand(cmds...)
2929
return cmd

pkg/cmd/admin/network/pod_network.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"io"
55

66
"github.com/spf13/cobra"
7+
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
78

89
"github.com/openshift/origin/pkg/cmd/templates"
9-
cmdutil "github.com/openshift/origin/pkg/cmd/util"
1010
"github.com/openshift/origin/pkg/cmd/util/clientcmd"
1111
)
1212

@@ -19,13 +19,13 @@ var (
1919
This command provides common pod network operations for administrators.`)
2020
)
2121

22-
func NewCmdPodNetwork(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
22+
func NewCmdPodNetwork(name, fullName string, f *clientcmd.Factory, out, errOut io.Writer) *cobra.Command {
2323
// Parent command to which all subcommands are added.
2424
cmds := &cobra.Command{
2525
Use: name,
2626
Short: "Manage pod network",
2727
Long: podNetworkLong,
28-
Run: cmdutil.DefaultSubCommandRun(out),
28+
Run: cmdutil.DefaultSubCommandRun(errOut),
2929
}
3030

3131
cmds.AddCommand(NewCmdJoinProjectsNetwork(JoinProjectsNetworkCommandName, fullName+" "+JoinProjectsNetworkCommandName, f, out))

pkg/cmd/admin/policy/policy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
kapi "k8s.io/kubernetes/pkg/api"
88
kapierrors "k8s.io/kubernetes/pkg/api/errors"
9+
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
910
"k8s.io/kubernetes/pkg/util/sets"
1011
"k8s.io/kubernetes/pkg/util/uuid"
1112

@@ -14,7 +15,6 @@ import (
1415
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
1516
"github.com/openshift/origin/pkg/client"
1617
"github.com/openshift/origin/pkg/cmd/templates"
17-
cmdutil "github.com/openshift/origin/pkg/cmd/util"
1818
"github.com/openshift/origin/pkg/cmd/util/clientcmd"
1919
)
2020

pkg/cmd/admin/prune/prune.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"io"
55

66
"github.com/spf13/cobra"
7+
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
78

89
groups "github.com/openshift/origin/pkg/cmd/admin/groups/sync/cli"
910
"github.com/openshift/origin/pkg/cmd/templates"
10-
cmdutil "github.com/openshift/origin/pkg/cmd/util"
1111
"github.com/openshift/origin/pkg/cmd/util/clientcmd"
1212
)
1313

@@ -22,13 +22,13 @@ var pruneLong = templates.LongDesc(`
2222
The commands here allow administrators to manage the older versions of resources on
2323
the system by removing them.`)
2424

25-
func NewCommandPrune(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
25+
func NewCommandPrune(name, fullName string, f *clientcmd.Factory, out, errOut io.Writer) *cobra.Command {
2626
// Parent command to which all subcommands are added.
2727
cmds := &cobra.Command{
2828
Use: name,
2929
Short: "Remove older versions of resources from the server",
3030
Long: pruneLong,
31-
Run: cmdutil.DefaultSubCommandRun(out),
31+
Run: cmdutil.DefaultSubCommandRun(errOut),
3232
}
3333

3434
cmds.AddCommand(NewCmdPruneBuilds(f, fullName, PruneBuildsRecommendedName, out))

pkg/cmd/admin/top/top.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ import (
66
"github.com/spf13/cobra"
77

88
kcmd "k8s.io/kubernetes/pkg/kubectl/cmd"
9+
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
910

1011
"github.com/openshift/origin/pkg/cmd/templates"
11-
cmdutil "github.com/openshift/origin/pkg/cmd/util"
12-
1312
"github.com/openshift/origin/pkg/cmd/util/clientcmd"
1413
)
1514

@@ -21,13 +20,13 @@ var topLong = templates.LongDesc(`
2120
This command analyzes resources managed by the platform and presents current
2221
usage statistics.`)
2322

24-
func NewCommandTop(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
23+
func NewCommandTop(name, fullName string, f *clientcmd.Factory, out, errOut io.Writer) *cobra.Command {
2524
// Parent command to which all subcommands are added.
2625
cmds := &cobra.Command{
2726
Use: name,
2827
Short: "Show usage statistics of resources on the server",
2928
Long: topLong,
30-
Run: cmdutil.DefaultSubCommandRun(out),
29+
Run: cmdutil.DefaultSubCommandRun(errOut),
3130
}
3231

3332
cmds.AddCommand(NewCmdTopImages(f, fullName, TopImagesRecommendedName, out))

pkg/cmd/admin/validate/validate.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"io"
55

66
"github.com/spf13/cobra"
7+
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
78

89
"github.com/openshift/origin/pkg/cmd/templates"
9-
cmdutil "github.com/openshift/origin/pkg/cmd/util"
1010
)
1111

1212
const (
@@ -21,14 +21,14 @@ var validateLong = templates.LongDesc(`
2121
2222
The commands here allow administrators to validate the integrity of configuration files.`)
2323

24-
func NewCommandValidate(name, fullName string, out io.Writer) *cobra.Command {
24+
func NewCommandValidate(name, fullName string, out, errOut io.Writer) *cobra.Command {
2525
// Parent command to which all subcommands are added.
2626
cmds := &cobra.Command{
2727
Use: name,
2828
Short: "Validate configuration file integrity",
2929
Long: validateLong,
3030
Deprecated: validateDeprecationMessage,
31-
Run: cmdutil.DefaultSubCommandRun(out),
31+
Run: cmdutil.DefaultSubCommandRun(errOut),
3232
}
3333

3434
cmds.AddCommand(NewCommandValidateMasterConfig(ValidateMasterConfigRecommendedName,

pkg/cmd/cli/cli.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/spf13/pflag"
1313

1414
kubecmd "k8s.io/kubernetes/pkg/kubectl/cmd"
15+
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
1516

1617
"github.com/openshift/origin/pkg/cmd/admin"
1718
"github.com/openshift/origin/pkg/cmd/cli/cmd"
@@ -28,7 +29,6 @@ import (
2829
"github.com/openshift/origin/pkg/cmd/cli/secrets"
2930
"github.com/openshift/origin/pkg/cmd/flagtypes"
3031
"github.com/openshift/origin/pkg/cmd/templates"
31-
cmdutil "github.com/openshift/origin/pkg/cmd/util"
3232
"github.com/openshift/origin/pkg/cmd/util/clientcmd"
3333
"github.com/openshift/origin/pkg/cmd/util/term"
3434
)
@@ -77,7 +77,7 @@ func NewCommandCLI(name, fullName string, in io.Reader, out, errout io.Writer) *
7777
Run: func(c *cobra.Command, args []string) {
7878
explainOut := term.NewResponsiveWriter(out)
7979
c.SetOutput(explainOut)
80-
cmdutil.RequireNoArguments(c, args)
80+
kcmdutil.RequireNoArguments(c, args)
8181
fmt.Fprintf(explainOut, "%s\n\n%s\n", cliLong, fmt.Sprintf(cliExplain, fullName))
8282
},
8383
BashCompletionFunction: bashCompletionFunc,
@@ -86,7 +86,7 @@ func NewCommandCLI(name, fullName string, in io.Reader, out, errout io.Writer) *
8686
f := clientcmd.New(cmds.PersistentFlags())
8787

8888
loginCmd := login.NewCmdLogin(fullName, f, in, out)
89-
secretcmds := secrets.NewCmdSecrets(secrets.SecretsRecommendedName, fullName+" "+secrets.SecretsRecommendedName, f, in, out, fullName+" edit")
89+
secretcmds := secrets.NewCmdSecrets(secrets.SecretsRecommendedName, fullName+" "+secrets.SecretsRecommendedName, f, in, out, errout, fullName+" edit")
9090

9191
groups := templates.CommandGroups{
9292
{
@@ -107,7 +107,7 @@ func NewCommandCLI(name, fullName string, in io.Reader, out, errout io.Writer) *
107107
{
108108
Message: "Build and Deploy Commands:",
109109
Commands: []*cobra.Command{
110-
rollout.NewCmdRollout(fullName, f, out),
110+
rollout.NewCmdRollout(fullName, f, out, errout),
111111
cmd.NewCmdDeploy(fullName, f, out),
112112
cmd.NewCmdRollback(fullName, f, out),
113113
cmd.NewCmdNewBuild(cmd.NewBuildRecommendedCommandName, fullName, f, in, out, errout),
@@ -131,7 +131,7 @@ func NewCommandCLI(name, fullName string, in io.Reader, out, errout io.Writer) *
131131
cmd.NewCmdScale(fullName, f, out),
132132
cmd.NewCmdAutoscale(fullName, f, out),
133133
secretcmds,
134-
sa.NewCmdServiceAccounts(sa.ServiceAccountsRecommendedName, fullName+" "+sa.ServiceAccountsRecommendedName, f, out),
134+
sa.NewCmdServiceAccounts(sa.ServiceAccountsRecommendedName, fullName+" "+sa.ServiceAccountsRecommendedName, f, out, errout),
135135
},
136136
},
137137
{
@@ -152,15 +152,15 @@ func NewCommandCLI(name, fullName string, in io.Reader, out, errout io.Writer) *
152152
Message: "Advanced Commands:",
153153
Commands: []*cobra.Command{
154154
admin.NewCommandAdmin("adm", fullName+" "+"adm", in, out, errout),
155-
cmd.NewCmdCreate(fullName, f, out),
155+
cmd.NewCmdCreate(fullName, f, out, errout),
156156
cmd.NewCmdReplace(fullName, f, out),
157157
cmd.NewCmdApply(fullName, f, out),
158158
cmd.NewCmdPatch(fullName, f, out),
159159
cmd.NewCmdProcess(fullName, f, out, errout),
160160
cmd.NewCmdExport(fullName, f, in, out),
161161
cmd.NewCmdExtract(fullName, f, in, out, errout),
162162
observe.NewCmdObserve(fullName, f, out, errout),
163-
policy.NewCmdPolicy(policy.PolicyRecommendedName, fullName+" "+policy.PolicyRecommendedName, f, out),
163+
policy.NewCmdPolicy(policy.PolicyRecommendedName, fullName+" "+policy.PolicyRecommendedName, f, out, errout),
164164
cmd.NewCmdConvert(fullName, f, out),
165165
importer.NewCmdImport(fullName, f, in, out, errout),
166166
},
@@ -169,7 +169,7 @@ func NewCommandCLI(name, fullName string, in io.Reader, out, errout io.Writer) *
169169
Message: "Settings Commands:",
170170
Commands: []*cobra.Command{
171171
login.NewCmdLogout("logout", fullName+" logout", fullName+" login", f, in, out),
172-
cmd.NewCmdConfig(fullName, "config"),
172+
cmd.NewCmdConfig(fullName, "config", out, errout),
173173
cmd.NewCmdWhoAmI(cmd.WhoAmIRecommendedCommandName, fullName+" "+cmd.WhoAmIRecommendedCommandName, f, out),
174174
cmd.NewCmdCompletion(fullName, f, out),
175175
},

pkg/cmd/cli/cmd/cluster/cluster.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import (
55
"io"
66

77
"github.com/spf13/cobra"
8+
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
89

910
"github.com/openshift/origin/pkg/bootstrap/docker"
1011
"github.com/openshift/origin/pkg/cmd/templates"
11-
cmdutil "github.com/openshift/origin/pkg/cmd/util"
1212
"github.com/openshift/origin/pkg/cmd/util/clientcmd"
1313
)
1414

@@ -39,7 +39,7 @@ func NewCmdCluster(name, fullName string, f *clientcmd.Factory, out, errout io.W
3939
Use: fmt.Sprintf("%s ACTION", name),
4040
Short: "Start and stop OpenShift cluster",
4141
Long: clusterLong,
42-
Run: cmdutil.DefaultSubCommandRun(out),
42+
Run: cmdutil.DefaultSubCommandRun(errout),
4343
}
4444

4545
cmds.AddCommand(docker.NewCmdUp(docker.CmdUpRecommendedName, fullName+" "+docker.CmdUpRecommendedName, f, out, errout))

pkg/cmd/cli/cmd/create/route.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ var (
2626
)
2727

2828
// NewCmdCreateRoute is a macro command to create a secured route.
29-
func NewCmdCreateRoute(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
29+
func NewCmdCreateRoute(fullName string, f *clientcmd.Factory, out, errOut io.Writer) *cobra.Command {
3030
cmd := &cobra.Command{
3131
Use: "route",
3232
Short: "Expose containers externally via secured routes",
3333
Long: fmt.Sprintf(routeLong, fullName),
34-
Run: cmdutil.DefaultSubCommandRun(out),
34+
Run: kcmdutil.DefaultSubCommandRun(errOut),
3535
}
3636

3737
cmd.AddCommand(NewCmdCreateEdgeRoute(fullName, f, out))

pkg/cmd/cli/cmd/importer/import.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
"io"
66

77
"github.com/spf13/cobra"
8+
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
89

910
"github.com/openshift/origin/pkg/cmd/templates"
10-
cmdutil "github.com/openshift/origin/pkg/cmd/util"
1111
"github.com/openshift/origin/pkg/cmd/util/clientcmd"
1212
)
1313

@@ -24,7 +24,7 @@ func NewCmdImport(fullName string, f *clientcmd.Factory, in io.Reader, out, erro
2424
Use: "import COMMAND",
2525
Short: "Commands that import applications",
2626
Long: importLong,
27-
Run: cmdutil.DefaultSubCommandRun(out),
27+
Run: cmdutil.DefaultSubCommandRun(errout),
2828
}
2929

3030
name := fmt.Sprintf("%s import", fullName)

0 commit comments

Comments
 (0)