Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization: Categorize cmd modules by type #1680

Merged
merged 6 commits into from
Sep 5, 2022

Conversation

Stevent-fei
Copy link
Collaborator

Describe what this PR does / why we need it

  1. Categorize cmd modules by type
  2. Divided into cluster module and image module by type

Does this pull request fix one issue?

Describe how you did it

Describe how to verify it

Special notes for reviews

@codecov-commenter
Copy link

codecov-commenter commented Aug 31, 2022

Codecov Report

Base: 18.23% // Head: 18.59% // Increases project coverage by +0.36% 🎉

Coverage data is based on head (c82f909) compared to base (3bc8b41).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1680      +/-   ##
==========================================
+ Coverage   18.23%   18.59%   +0.36%     
==========================================
  Files          68       71       +3     
  Lines        5500     5667     +167     
==========================================
+ Hits         1003     1054      +51     
- Misses       4374     4480     +106     
- Partials      123      133      +10     
Impacted Files Coverage Δ
pkg/clusterfile/clusterfile.go 71.42% <0.00%> (ø)
pkg/clusterfile/util.go 0.00% <0.00%> (ø)
pkg/clusterfile/decoder.go 44.44% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

import "github.com/spf13/cobra"

func NewCmdCluster() *cobra.Command {
cmd := &cobra.Command{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to add cluster cmd. just add those sub cmd to root cmd.

Short: "image sub-commands",
}
cmd.AddCommand(NewBuildCmd())
cmd.AddCommand(NewCompletionCmd())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NewCompletionCmd, NewCompletionCmd is not belong to image

import "github.com/spf13/cobra"

func NewCmdImage() *cobra.Command {
cmd := &cobra.Command{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just add those cmd to root cmd.

cmd.AddCommand(NewSaveCmd())
cmd.AddCommand(NewSearchCmd())
cmd.AddCommand(NewTagCmd())
cmd.AddCommand(NewVersionCmd())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same issue: versionCMD is not belong to image

Use: "apply",
Short: "apply a Kubernetes cluster via specified Clusterfile",
Long: `apply command is used to apply a Kubernetes cluster via specified Clusterfile.
var longNewApplyCmdDescription = `apply command is used to apply a Kubernetes cluster via specified Clusterfile.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const


import "github.com/spf13/cobra"

func NewCmdImage() *cobra.Command {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NewImageCommands()[]*cobra.Command{}

Use: "check",
Short: "check the state of cluster",
Long: longNewCheckCmdDescription,
Example: `sealer check --pre or sealer check --post`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sealer check --pre \n sealer check --post

@@ -38,7 +38,7 @@ func NewCheckCmd() *cobra.Command {
Use: "check",
Short: "check the state of cluster",
Long: longNewCheckCmdDescription,
Example: `sealer check --pre or sealer check --post`,
Example: `sealer check --pre \n sealer check --post`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean change line at "\n", not change or to "\n"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, didn't look carefully😢

Copy link
Member

@justadogistaken justadogistaken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
@kakaZhou719 PTAL

@justadogistaken justadogistaken merged commit 627e4f8 into sealerio:main Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants