Handle config, parse flags

This commit is contained in:
nemunaire 2025-10-17 15:17:49 +07:00
commit 449a8a2c67
6 changed files with 375 additions and 8 deletions

View file

@ -31,12 +31,12 @@ func main() {
fmt.Println("Mail Tester - Email Deliverability Testing Platform")
fmt.Println("Version: 0.1.0-dev")
if len(os.Args) < 2 {
printUsage()
os.Exit(1)
cfg, err := config.ConsolidateConfig()
if err != nil {
log.Fatal(err.Error())
}
command := os.Args[1]
command := flag.Arg(0)
switch command {
case "server":
@ -55,8 +55,10 @@ func main() {
}
func printUsage() {
fmt.Println("\nUsage:")
fmt.Println(" mailtester server - Start the API server")
fmt.Println(" mailtester analyze - Start the email analyzer (MDA mode)")
fmt.Println(" mailtester version - Print version information")
fmt.Println("\nCommand availables:")
fmt.Println(" happyDeliver server - Start the API server")
fmt.Println(" happyDeliver analyze [-recipient EMAIL] - Analyze email from stdin (MDA mode)")
fmt.Println(" happyDeliver version - Print version information")
fmt.Println("")
flag.Usage()
}