-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: clusteradm get klusterlet-info (#143)
* add get klusterlet-info command add common utility PrintComponentsCRD for cluster-manager/klusterlet to print crd Signed-off-by: ycyaoxdu <[email protected]> * fix: use common utility printer.PrintComponentsCRD to replace printComponentsCRD, printer.PrintComponentsDeploy to replace printComponentsDelpoyment. Signed-off-by: ycyaoxdu <[email protected]>
- Loading branch information
Showing
6 changed files
with
364 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright Contributors to the Open Cluster Management project | ||
package klusterletinfo | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
"k8s.io/cli-runtime/pkg/genericclioptions" | ||
genericclioptionsclusteradm "open-cluster-management.io/clusteradm/pkg/genericclioptions" | ||
clusteradmhelpers "open-cluster-management.io/clusteradm/pkg/helpers" | ||
) | ||
|
||
var example = ` | ||
# Get klusterlet-info. | ||
%[1]s get klusterlet-info | ||
` | ||
|
||
// NewCmd... | ||
func NewCmd(clusteradmFlags *genericclioptionsclusteradm.ClusteradmFlags, streams genericclioptions.IOStreams) *cobra.Command { | ||
o := newOptions(clusteradmFlags, streams) | ||
|
||
cmd := &cobra.Command{ | ||
Use: "klusterlet-info", | ||
Short: "get klusterlet-info", | ||
Example: fmt.Sprintf(example, clusteradmhelpers.GetExampleHeader()), | ||
SilenceUsage: true, | ||
PreRunE: func(c *cobra.Command, args []string) error { | ||
clusteradmhelpers.DryRunMessage(clusteradmFlags.DryRun) | ||
return nil | ||
}, | ||
RunE: func(c *cobra.Command, args []string) error { | ||
if err := o.complete(c, args); err != nil { | ||
return err | ||
} | ||
if err := o.validate(args); err != nil { | ||
return err | ||
} | ||
if err := o.run(); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
}, | ||
} | ||
|
||
return cmd | ||
} |
Oops, something went wrong.