refactor: migrate backend main function
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user