feat: add resetpwd cmd

This commit is contained in:
engigu
2026-02-27 23:08:44 +08:00
parent 8775bec155
commit d9e73a9d18
10 changed files with 206 additions and 16 deletions
+24 -11
View File
@@ -4,25 +4,38 @@ import (
"fmt"
"os"
"github.com/engigu/baihu-panel/cmd/reposync"
"github.com/engigu/baihu-panel/cmd"
"github.com/engigu/baihu-panel/internal/bootstrap"
"github.com/engigu/baihu-panel/internal/constant"
)
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)
}
}
func main() {
if len(os.Args) < 2 {
printHelp()
os.Exit(1)
}
commandName := os.Args[1]
if commandName == "server" {
bootstrap.New().Run()
return
}
cmd := os.Args[1]
switch cmd {
case "server":
bootstrap.New().Run()
case "reposync":
reposync.Run(os.Args[2:])
default:
fmt.Printf("Unknown command: %s\n", cmd)
fmt.Println("Available commands: server, reposync")
os.Exit(1)
if handler, ok := cmd.Handlers[commandName]; ok {
handler(os.Args[2:])
return
}
fmt.Printf("Unknown command: %s\n", commandName)
printHelp()
os.Exit(1)
}