Handle config, parse flags
This commit is contained in:
parent
338a07a577
commit
449a8a2c67
6 changed files with 375 additions and 8 deletions
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue