1
0

refactor: migrate backend main function

This commit is contained in:
2026-07-17 10:53:29 +08:00
parent 3c0a763572
commit 44e1415194
2 changed files with 63 additions and 21 deletions

View File

@@ -13,6 +13,10 @@ type CLIArgs struct {
Config string
// Init indicates whether to initialize the calendar system before running.
Init bool
// Username is the first admin user's name; required together with --init.
Username string
// Password is the first admin user's password; required together with --init.
Password string
}
// Parse parses the command-line arguments via the standard flag package and
@@ -31,8 +35,12 @@ func Parse() *CLIArgs {
}
// --config maps to the legacy -c/--config (required), --init to -i/--init.
// --username/--password replace the legacy interactive GetUsernamePassword
// prompt and are required together with --init.
flag.StringVar(&args.Config, "config", "", "The configuration file `CONFIG_TOML` for coconut-leaf")
flag.BoolVar(&args.Init, "init", false, "Set for initialize the calendar system")
flag.StringVar(&args.Username, "username", "", "The first admin user's name (required with --init)")
flag.StringVar(&args.Password, "password", "", "The first admin user's password (required with --init)")
flag.Parse()