Files
dance-lessons-coach/cmd/cli/main.go
Gabriel Radureau 183933b43e
Some checks failed
Go CI/CD Pipeline / Lint and Format (push) Successful in 4m51s
Docker Build and Publish / Version Bump (push) Successful in 4m54s
Docker Build and Publish / Build and Push Docker Image (push) Failing after 2m51s
Go CI/CD Pipeline / Build and Test (push) Successful in 9m47s
Go CI/CD Pipeline / Version Management (push) Successful in 12s
feat: integrate swag fmt and improve CI/CD workflows
- Add swag fmt to git pre-commit hook and CI/CD pipeline
- Create comprehensive CONTRIBUTING.md guide with AI section
- Update ADR-0013 with swag fmt documentation
- Fix swagger generation to include all endpoints
- Improve local testing scripts and workflows
- Update Dockerfile for better swagger handling
- Fix CI/CD workflow file references
2026-04-06 15:36:55 +02:00

79 lines
1.8 KiB
Go

package main
import (
"context"
"fmt"
"DanceLessonsCoach/pkg/config"
"DanceLessonsCoach/pkg/server"
"DanceLessonsCoach/pkg/version"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "dance-lessons-coach",
Short: "DanceLessonsCoach - API server and CLI tools",
Long: `DanceLessonsCoach provides greeting services and API management.
To begin working with DanceLessonsCoach, run:
dance-lessons-coach server --help`,
SilenceUsage: true,
}
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print version information",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(version.Full())
},
}
var serverCmd = &cobra.Command{
Use: "server",
Short: "Start the DanceLessonsCoach server",
Run: func(cmd *cobra.Command, args []string) {
// Load config and start server
cfg, err := config.LoadConfig()
if err != nil {
log.Fatal().Err(err).Msg("Failed to load configuration")
}
server := server.NewServer(cfg, context.Background())
if err := server.Run(); err != nil {
log.Fatal().Err(err).Msg("Server failed")
}
},
}
var greetCmd = &cobra.Command{
Use: "greet [name]",
Short: "Greet someone by name",
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
name := ""
if len(args) > 0 {
name = args[0]
}
fmt.Printf("Hello %s!\n", name)
},
}
func init() {
rootCmd.AddCommand(versionCmd)
rootCmd.AddCommand(serverCmd)
rootCmd.AddCommand(greetCmd)
// Add flags to server command
serverCmd.Flags().String("config", "", "Config file path")
serverCmd.Flags().String("env", "", "Environment (dev, staging, prod)")
serverCmd.Flags().Bool("debug", false, "Enable debug logging")
}
func main() {
if err := rootCmd.Execute(); err != nil {
log.Fatal().Err(err).Msg("CLI execution failed")
}
}