feat(cmd): restore startup banner display in CLI entrypoints

This commit is contained in:
ryan
2026-08-28 15:46:58 +08:00
parent 3df621637f
commit 7fca53823a
5 changed files with 17 additions and 2 deletions
+4
View File
@@ -16,6 +16,10 @@ var allCmd = &cobra.Command{
Use: "all", Use: "all",
Short: "以融合模式同时启动 API、Worker 和 Scheduler", Short: "以融合模式同时启动 API、Worker 和 Scheduler",
Run: func(_ *cobra.Command, _ []string) { Run: func(_ *cobra.Command, _ []string) {
printStartupBanner(startupState{
mode: "all (API + Worker + Scheduler)",
listensForHTTP: true,
})
app := newWaveletApp(core.ProfileAll) app := newWaveletApp(core.ProfileAll)
if err := app.Run(); err != nil { if err := app.Run(); err != nil {
log.Fatalf("[All] run failed: %v\n", err) log.Fatalf("[All] run failed: %v\n", err)
+4
View File
@@ -15,6 +15,10 @@ var apiCmd = &cobra.Command{
Use: "api", Use: "api",
Short: "wavelet API", Short: "wavelet API",
Run: func(_ *cobra.Command, _ []string) { Run: func(_ *cobra.Command, _ []string) {
printStartupBanner(startupState{
mode: "api",
listensForHTTP: true,
})
app := newWaveletApp(core.ProfileAPI) app := newWaveletApp(core.ProfileAPI)
if err := app.Run(); err != nil { if err := app.Run(); err != nil {
log.Fatalf("[API] run failed: %v\n", err) log.Fatalf("[API] run failed: %v\n", err)
+1 -2
View File
@@ -8,7 +8,6 @@ package cmd
import ( import (
"fmt" "fmt"
"log"
"runtime" "runtime"
"strings" "strings"
@@ -23,7 +22,7 @@ type startupState struct {
} }
func printStartupBanner(state startupState) { func printStartupBanner(state startupState) {
log.Print(formatStartupBanner(state)) fmt.Println(formatStartupBanner(state))
} }
func formatStartupBanner(state startupState) string { func formatStartupBanner(state startupState) string {
+4
View File
@@ -15,6 +15,10 @@ var schedulerCmd = &cobra.Command{
Use: "scheduler", Use: "scheduler",
Short: "wavelet Scheduler", Short: "wavelet Scheduler",
Run: func(_ *cobra.Command, _ []string) { Run: func(_ *cobra.Command, _ []string) {
printStartupBanner(startupState{
mode: "scheduler",
listensForHTTP: false,
})
app := newWaveletApp(core.ProfileSchedule) app := newWaveletApp(core.ProfileSchedule)
if err := app.Run(); err != nil { if err := app.Run(); err != nil {
log.Fatalf("[Scheduler] run failed: %v\n", err) log.Fatalf("[Scheduler] run failed: %v\n", err)
+4
View File
@@ -15,6 +15,10 @@ var workerCmd = &cobra.Command{
Use: "worker", Use: "worker",
Short: "wavelet Worker", Short: "wavelet Worker",
Run: func(_ *cobra.Command, _ []string) { Run: func(_ *cobra.Command, _ []string) {
printStartupBanner(startupState{
mode: "worker",
listensForHTTP: false,
})
app := newWaveletApp(core.ProfileWorker) app := newWaveletApp(core.ProfileWorker)
if err := app.Run(); err != nil { if err := app.Run(); err != nil {
log.Fatalf("[Worker] run failed: %v\n", err) log.Fatalf("[Worker] run failed: %v\n", err)