修改git过滤文件
This commit is contained in:
51
cmd/devpack/commands/list.go
Normal file
51
cmd/devpack/commands/list.go
Normal file
@@ -0,0 +1,51 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func newListCmd() *cobra.Command {
|
||||
var (
|
||||
output string
|
||||
detailed bool
|
||||
)
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "list [packs|profiles|collectors]",
|
||||
Short: "列出 Pack、Profile 或采集器",
|
||||
Long: `列出本地存储的 Pack、配置的 Profile 或所有可用的采集器。`,
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
subCmd := "packs"
|
||||
if len(args) > 0 {
|
||||
subCmd = args[0]
|
||||
}
|
||||
|
||||
switch subCmd {
|
||||
case "packs":
|
||||
fmt.Println("📦 Local Packs:")
|
||||
// TODO: List packs
|
||||
fmt.Println(" (none)")
|
||||
case "profiles":
|
||||
fmt.Println("📋 Profiles:")
|
||||
// TODO: List profiles
|
||||
fmt.Println(" (none)")
|
||||
case "collectors":
|
||||
fmt.Println("🔌 Available Collectors:")
|
||||
// TODO: List collectors
|
||||
fmt.Println(" (none)")
|
||||
default:
|
||||
return fmt.Errorf("未知的子命令: %s (可选: packs, profiles, collectors)", subCmd)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
cmd.Flags().StringVarP(&output, "output", "o", "table", "输出格式 (table|json|yaml)")
|
||||
cmd.Flags().BoolVar(&detailed, "detailed", false, "显示详细信息")
|
||||
|
||||
return cmd
|
||||
}
|
||||
Reference in New Issue
Block a user