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: 列出所有 Pack fmt.Println(" (none)") case "profiles": fmt.Println("📋 Profiles:") // TODO: 列出所有 Profile fmt.Println(" (none)") case "collectors": fmt.Println("🔌 Available Collectors:") // TODO: 列出所有采集器 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 }