Files
TaskPool/main.go
T

63 lines
1.3 KiB
Go
Raw Normal View History

2025-12-20 09:30:16 +08:00
package main
2026-02-27 11:35:55 +08:00
import (
"fmt"
"os"
2026-02-27 23:08:44 +08:00
"github.com/engigu/baihu-panel/cmd"
2026-02-27 11:35:55 +08:00
"github.com/engigu/baihu-panel/internal/bootstrap"
2026-02-27 23:08:44 +08:00
"github.com/engigu/baihu-panel/internal/constant"
2026-02-27 11:35:55 +08:00
)
2025-12-20 09:30:16 +08:00
2026-03-05 20:19:35 +08:00
// @title Baihu Panel API
// @version 1.0
2026-03-06 17:24:39 +08:00
// @description Baihu Panel OpenAPI Server documentation.
2026-03-05 20:19:35 +08:00
// @termsOfService http://swagger.io/terms/
// @contact.name API Support
// @contact.url http://www.swagger.io/support
// @contact.email support@swagger.io
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @host localhost:8052
2026-03-06 17:24:39 +08:00
// @BasePath /open2api/v1
2026-03-05 20:19:35 +08:00
// @query.collection.format multi
2026-03-06 17:24:39 +08:00
// @securityDefinitions.apikey BearerAuth
2026-03-05 20:19:35 +08:00
// @in header
// @name Authorization
2026-03-06 17:24:39 +08:00
// @description Type "Bearer" followed by a space and the API token.
2026-03-05 20:19:35 +08:00
2026-02-27 23:08:44 +08:00
func printHelp() {
fmt.Println("Usage: baihu <command> [arguments]")
fmt.Println("Available commands:")
for _, info := range constant.Commands {
fmt.Printf(" %-12s %s\n", info.Name, info.Description)
}
}
2025-12-20 09:30:16 +08:00
func main() {
2026-02-27 11:35:55 +08:00
if len(os.Args) < 2 {
2026-02-27 23:08:44 +08:00
printHelp()
os.Exit(1)
}
commandName := os.Args[1]
if commandName == "server" {
2026-02-27 11:35:55 +08:00
bootstrap.New().Run()
return
}
2026-02-27 23:08:44 +08:00
if handler, ok := cmd.Handlers[commandName]; ok {
handler(os.Args[2:])
return
2026-02-27 11:35:55 +08:00
}
2026-02-27 23:08:44 +08:00
fmt.Printf("Unknown command: %s\n", commandName)
printHelp()
os.Exit(1)
2025-12-20 09:30:16 +08:00
}