add commandGroup annotation to ctl command
Signed-off-by: zhzhuang-zju <m17799853869@163.com>
This commit is contained in:
parent
7a2b493fba
commit
d351e3dc72
|
@ -71,7 +71,7 @@ func GenMarkdownTreeForIndex(cmd *cobra.Command, dir string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tp := range []string{util.GroupBasic, util.GroupClusterRegistration, util.GroupClusterManagement, util.GroupClusterTroubleshootingAndDebugging, util.GroupAdvancedCommands} {
|
for _, tp := range []string{util.GroupBasic, util.GroupClusterRegistration, util.GroupClusterManagement, util.GroupClusterTroubleshootingAndDebugging, util.GroupAdvancedCommands, util.GroupSettingsCommands, util.GroupOtherCommands} {
|
||||||
// write header of type
|
// write header of type
|
||||||
_, err = io.WriteString(f, "## "+tp+"\n\n")
|
_, err = io.WriteString(f, "## "+tp+"\n\n")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -51,5 +51,8 @@ var (
|
||||||
func NewCmdAnnotate(f util.Factory, parentCommand string, ioStreams genericiooptions.IOStreams) *cobra.Command {
|
func NewCmdAnnotate(f util.Factory, parentCommand string, ioStreams genericiooptions.IOStreams) *cobra.Command {
|
||||||
cmd := kubectlannotate.NewCmdAnnotate(parentCommand, f, ioStreams)
|
cmd := kubectlannotate.NewCmdAnnotate(parentCommand, f, ioStreams)
|
||||||
cmd.Example = fmt.Sprintf(annotateExample, parentCommand)
|
cmd.Example = fmt.Sprintf(annotateExample, parentCommand)
|
||||||
|
cmd.Annotations = map[string]string{
|
||||||
|
util.TagCommandGroup: util.GroupSettingsCommands,
|
||||||
|
}
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,9 @@ func NewCmdAPIResources(f util.Factory, parentCommand string, ioStreams generici
|
||||||
cmdutil.CheckErr(o.Validate())
|
cmdutil.CheckErr(o.Validate())
|
||||||
cmdutil.CheckErr(o.RunAPIResources())
|
cmdutil.CheckErr(o.RunAPIResources())
|
||||||
},
|
},
|
||||||
|
Annotations: map[string]string{
|
||||||
|
util.TagCommandGroup: util.GroupOtherCommands,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
o.OperationScope = options.KarmadaControlPlane
|
o.OperationScope = options.KarmadaControlPlane
|
||||||
|
|
|
@ -53,6 +53,9 @@ func NewCmdAPIVersions(f util.Factory, parentCommand string, ioStreams genericio
|
||||||
cmdutil.CheckErr(o.Validate())
|
cmdutil.CheckErr(o.Validate())
|
||||||
cmdutil.CheckErr(o.RunAPIVersions())
|
cmdutil.CheckErr(o.RunAPIVersions())
|
||||||
},
|
},
|
||||||
|
Annotations: map[string]string{
|
||||||
|
util.TagCommandGroup: util.GroupOtherCommands,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
o.OperationScope = options.KarmadaControlPlane
|
o.OperationScope = options.KarmadaControlPlane
|
||||||
|
|
|
@ -70,6 +70,9 @@ func NewCmdAttach(f util.Factory, parentCommand string, streams genericiooptions
|
||||||
cmdutil.CheckErr(o.Validate())
|
cmdutil.CheckErr(o.Validate())
|
||||||
cmdutil.CheckErr(o.Run())
|
cmdutil.CheckErr(o.Run())
|
||||||
},
|
},
|
||||||
|
Annotations: map[string]string{
|
||||||
|
util.TagCommandGroup: util.GroupClusterTroubleshootingAndDebugging,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdutil.AddPodRunningTimeoutFlag(cmd, defaultPodAttachTimeout)
|
cmdutil.AddPodRunningTimeoutFlag(cmd, defaultPodAttachTimeout)
|
||||||
|
|
|
@ -49,5 +49,8 @@ func NewCmdCreate(f util.Factory, parentCommnd string, ioStreams genericiooption
|
||||||
cmd := kubectlcreate.NewCmdCreate(f, ioStreams)
|
cmd := kubectlcreate.NewCmdCreate(f, ioStreams)
|
||||||
cmd.Long = fmt.Sprintf(createLong, parentCommnd)
|
cmd.Long = fmt.Sprintf(createLong, parentCommnd)
|
||||||
cmd.Example = fmt.Sprintf(createExample, parentCommnd)
|
cmd.Example = fmt.Sprintf(createExample, parentCommnd)
|
||||||
|
cmd.Annotations = map[string]string{
|
||||||
|
util.TagCommandGroup: util.GroupBasic,
|
||||||
|
}
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,5 +92,8 @@ func NewCmdDelete(f util.Factory, parentCommnd string, ioStreams genericiooption
|
||||||
cmd := kubectldelete.NewCmdDelete(f, ioStreams)
|
cmd := kubectldelete.NewCmdDelete(f, ioStreams)
|
||||||
cmd.Long = fmt.Sprintf(deleteLong, parentCommnd)
|
cmd.Long = fmt.Sprintf(deleteLong, parentCommnd)
|
||||||
cmd.Example = fmt.Sprintf(deleteExample, parentCommnd)
|
cmd.Example = fmt.Sprintf(deleteExample, parentCommnd)
|
||||||
|
cmd.Annotations = map[string]string{
|
||||||
|
util.TagCommandGroup: util.GroupBasic,
|
||||||
|
}
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,5 +50,8 @@ var (
|
||||||
func NewCmdEdit(f util.Factory, parentCommand string, ioStreams genericiooptions.IOStreams) *cobra.Command {
|
func NewCmdEdit(f util.Factory, parentCommand string, ioStreams genericiooptions.IOStreams) *cobra.Command {
|
||||||
cmd := kubectledit.NewCmdEdit(f, ioStreams)
|
cmd := kubectledit.NewCmdEdit(f, ioStreams)
|
||||||
cmd.Example = fmt.Sprintf(editExample, parentCommand)
|
cmd.Example = fmt.Sprintf(editExample, parentCommand)
|
||||||
|
cmd.Annotations = map[string]string{
|
||||||
|
util.TagCommandGroup: util.GroupBasic,
|
||||||
|
}
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,9 @@ func NewCmdExplain(f util.Factory, parentCommand string, streams genericiooption
|
||||||
cmdutil.CheckErr(o.Validate())
|
cmdutil.CheckErr(o.Validate())
|
||||||
cmdutil.CheckErr(o.Run())
|
cmdutil.CheckErr(o.Run())
|
||||||
},
|
},
|
||||||
|
Annotations: map[string]string{
|
||||||
|
util.TagCommandGroup: util.GroupBasic,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
flags := cmd.Flags()
|
flags := cmd.Flags()
|
||||||
|
|
|
@ -50,5 +50,8 @@ var (
|
||||||
func NewCmdLabel(f util.Factory, parentCommand string, ioStreams genericiooptions.IOStreams) *cobra.Command {
|
func NewCmdLabel(f util.Factory, parentCommand string, ioStreams genericiooptions.IOStreams) *cobra.Command {
|
||||||
cmd := kubectllabel.NewCmdLabel(f, ioStreams)
|
cmd := kubectllabel.NewCmdLabel(f, ioStreams)
|
||||||
cmd.Example = fmt.Sprintf(labelExample, parentCommand)
|
cmd.Example = fmt.Sprintf(labelExample, parentCommand)
|
||||||
|
cmd.Annotations = map[string]string{
|
||||||
|
util.TagCommandGroup: util.GroupSettingsCommands,
|
||||||
|
}
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,5 +46,8 @@ var (
|
||||||
func NewCmdPatch(f util.Factory, parentCommand string, ioStreams genericiooptions.IOStreams) *cobra.Command {
|
func NewCmdPatch(f util.Factory, parentCommand string, ioStreams genericiooptions.IOStreams) *cobra.Command {
|
||||||
cmd := kubectlpatch.NewCmdPatch(f, ioStreams)
|
cmd := kubectlpatch.NewCmdPatch(f, ioStreams)
|
||||||
cmd.Example = fmt.Sprintf(patchExample, parentCommand)
|
cmd.Example = fmt.Sprintf(patchExample, parentCommand)
|
||||||
|
cmd.Annotations = map[string]string{
|
||||||
|
util.TagCommandGroup: util.GroupAdvancedCommands,
|
||||||
|
}
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,9 @@ func NewCmdTop(f util.Factory, parentCommand string, streams genericiooptions.IO
|
||||||
Short: "Display resource (CPU/memory) usage of member clusters",
|
Short: "Display resource (CPU/memory) usage of member clusters",
|
||||||
Long: topLong,
|
Long: topLong,
|
||||||
Run: cmdutil.DefaultSubCommandRun(streams.ErrOut),
|
Run: cmdutil.DefaultSubCommandRun(streams.ErrOut),
|
||||||
|
Annotations: map[string]string{
|
||||||
|
util.TagCommandGroup: util.GroupAdvancedCommands,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// create subcommands
|
// create subcommands
|
||||||
|
|
|
@ -36,4 +36,10 @@ const (
|
||||||
|
|
||||||
// GroupAdvancedCommands means the command belongs to Group "Advanced Commands"
|
// GroupAdvancedCommands means the command belongs to Group "Advanced Commands"
|
||||||
GroupAdvancedCommands = "Advanced Commands"
|
GroupAdvancedCommands = "Advanced Commands"
|
||||||
|
|
||||||
|
// GroupSettingsCommands means the command belongs to Group "Settings Commands"
|
||||||
|
GroupSettingsCommands = "Settings Commands"
|
||||||
|
|
||||||
|
// GroupOtherCommands means the command belongs to Group "Other Commands"
|
||||||
|
GroupOtherCommands = "Other Commands"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue