Skip to content

Commit

Permalink
fix(status): imp node status show
Browse files Browse the repository at this point in the history
imp node status show

Signed-off-by: ysicing <[email protected]>
  • Loading branch information
ysicing committed Aug 30, 2023
1 parent 29d0f58 commit 55d87b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
5 changes: 4 additions & 1 deletion cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package cmd

import (
"context"
"fmt"
"os"

statussubcmd "github.com/easysoft/qcadmin/cmd/status"
Expand Down Expand Up @@ -54,6 +55,8 @@ func newCmdStatus(f factory.Factory) *cobra.Command {
cmd.Flags().DurationVar(&params.WaitDuration, "wait-duration", common.StatusWaitDuration, "Maximum time to wait for status")
cmd.Flags().BoolVar(&params.IgnoreWarnings, "ignore-warnings", false, "Ignore warnings when waiting for status to report success")
cmd.Flags().StringVarP(&params.ListOutput, "output", "o", "", "prints the output in the specified format. Allowed values: table, json, yaml (default table)")
cmd.AddCommand(statussubcmd.TopNodeCmd())
topnode := statussubcmd.TopNodeCmd()
topnode.Deprecated = fmt.Sprintf("use %s instead", color.SGreen("%s cluster status nodes", os.Args[0]))
cmd.AddCommand(topnode)
return cmd
}
11 changes: 3 additions & 8 deletions cmd/status/top.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,25 @@
package status

import (
"fmt"
"os"

"github.com/easysoft/qcadmin/internal/pkg/status/top"
"github.com/ergoapi/util/color"
"github.com/spf13/cobra"
"k8s.io/kubectl/pkg/util/templates"
)

var (
KRNodeExample = templates.Examples(`
q status node
q cluster status node
`)
)

func TopNodeCmd() *cobra.Command {
o := top.NodeOption{}
nodeCmd := &cobra.Command{
Use: "node",
Use: "nodes",
DisableFlagsInUseLine: true,
Short: "node provides an overview of the node",
Aliases: []string{"nodes", "no"},
Aliases: []string{"node", "no"},
Example: KRNodeExample,
Deprecated: fmt.Sprintf("use %s instead", color.SGreen("%s cluster status nodes", os.Args[0])),
Run: func(cmd *cobra.Command, args []string) {
o.Validate()
o.RunResourceNode()
Expand Down

0 comments on commit 55d87b8

Please sign in to comment.