Formatting only (gofmt -w on the 29 non-vendored, non-generated files gofmt -l reported); swag-generated apiserver/docs/docs.go left as is. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
56 lines
1.6 KiB
Go
56 lines
1.6 KiB
Go
package resources
|
|
|
|
import (
|
|
"xcecli/config"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// NewResourcesCmd creates a command for querying resource information
|
|
func NewResourcesCmd(configManager *config.ConfigManager) *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "resources",
|
|
GroupID: "query",
|
|
Short: "Manage resources",
|
|
Long: `Manage resources in the system.
|
|
Use 'xce resources distribution list' to query resources distribution information.
|
|
Use 'xce resources definition list' to query resources definition information.`,
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
// Display help when no subcommand is specified
|
|
cmd.Help()
|
|
},
|
|
}
|
|
|
|
// Add distribution subcommand
|
|
distributionCmd := &cobra.Command{
|
|
Use: "distribution",
|
|
Short: "Manage resource distribution",
|
|
Long: `Manage resource distribution information.
|
|
Use 'xce resources distribution list' to query resources distribution information.`,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
// Display help when no subcommand is specified
|
|
cmd.Help()
|
|
},
|
|
}
|
|
distributionCmd.AddCommand(NewListResourcesDistCmd(configManager))
|
|
|
|
// Add definition subcommand
|
|
definitionCmd := &cobra.Command{
|
|
Use: "definition",
|
|
Short: "Manage resource definition",
|
|
Long: `Manage resource definition information.
|
|
Use 'xce resources definition list' to query resources definition information.`,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
// Display help when no subcommand is specified
|
|
cmd.Help()
|
|
},
|
|
}
|
|
definitionCmd.AddCommand(NewListResourcesDefCmd(configManager))
|
|
|
|
// Add subcommands to main command
|
|
cmd.AddCommand(distributionCmd)
|
|
cmd.AddCommand(definitionCmd)
|
|
|
|
return cmd
|
|
}
|