test.go 426 B

12345678910111213141516171819202122232425262728
  1. package cmd
  2. import (
  3. log "github.com/sirupsen/logrus"
  4. "github.com/spf13/cobra"
  5. "standard/cobra/internal"
  6. "standard/cobra/internal/pkg/logger"
  7. )
  8. var(
  9. testCmd = &cobra.Command{
  10. Use: "test",
  11. Short: "Test cobra",
  12. Run: func(cmd *cobra.Command, args []string) {
  13. test(&logger.NewLogger())
  14. },
  15. }
  16. )
  17. func init() {
  18. rootCmd.AddCommand(testCmd)
  19. }
  20. func test(logger *log.Logger) {
  21. internal.Serve(logger)
  22. }