diff options
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/dtail-tools/main.go | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/cmd/dtail-tools/main.go b/cmd/dtail-tools/main.go new file mode 100644 index 0000000..591ed4b --- /dev/null +++ b/cmd/dtail-tools/main.go @@ -0,0 +1,53 @@ +package main + +import ( + "fmt" + "os" + + "github.com/mimecast/dtail/internal/tools/benchmark" + "github.com/mimecast/dtail/internal/tools/profile" +) + +func main() { + if len(os.Args) < 2 { + printUsage() + os.Exit(1) + } + + command := os.Args[1] + + // Remove command from args for subcommand parsing + os.Args = append([]string{os.Args[0]}, os.Args[2:]...) + + switch command { + case "profile": + if err := profile.Run(); err != nil { + fmt.Fprintf(os.Stderr, "Error: %v\n", err) + os.Exit(1) + } + case "benchmark": + if err := benchmark.Run(); err != nil { + fmt.Fprintf(os.Stderr, "Error: %v\n", err) + os.Exit(1) + } + case "help", "-h", "--help": + printUsage() + default: + fmt.Fprintf(os.Stderr, "Unknown command: %s\n", command) + printUsage() + os.Exit(1) + } +} + +func printUsage() { + fmt.Println("dtail-tools - DTail performance analysis toolkit") + fmt.Println() + fmt.Println("Usage: dtail-tools <command> [options]") + fmt.Println() + fmt.Println("Commands:") + fmt.Println(" profile Run profiling on dtail commands") + fmt.Println(" benchmark Run benchmarks and manage baselines") + fmt.Println(" help Show this help message") + fmt.Println() + fmt.Println("Run 'dtail-tools <command> -h' for command-specific help") +}
\ No newline at end of file |
