add test case for profile list

Signed-off-by: jason yang <jasonyangshadow@gmail.com>
This commit is contained in:
jason yang
2023-03-29 10:35:17 +00:00
parent 7265083ed0
commit 6dcd26322a
3 changed files with 113 additions and 30 deletions

View File

@@ -2,23 +2,22 @@ package list
import "github.com/spf13/cobra"
var (
baseCmd = &cobra.Command{
DisableFlagsInUseLine: true,
Use: "list [OPTIONS] [PROFILE ...]",
Short: "List profiles and configurations",
Long: "This command will display configurations for PROFILE.",
RunE: CobraRunE,
Aliases: []string{"ls"},
}
ShowAll bool
)
func init() {
baseCmd.PersistentFlags().BoolVarP(&ShowAll, "all", "a", false, "Show all node configurations")
type variables struct {
showAll bool
}
// GetRootCommand returns the root cobra.Command for the application.
func GetCommand() *cobra.Command {
vars := variables{}
baseCmd := &cobra.Command{
DisableFlagsInUseLine: true,
Use: "list [OPTIONS] [PROFILE ...]",
Short: "List profiles and configurations",
Long: "This command will display configurations for PROFILE.",
RunE: CobraRunE(&vars),
Aliases: []string{"ls"},
}
baseCmd.PersistentFlags().BoolVarP(&vars.showAll, "all", "a", false, "Show all node configurations")
return baseCmd
}