doc: update backend doc
This commit is contained in:
+8
-8
@@ -13,14 +13,14 @@ 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 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 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
|
||||
// returns a *CLIArgs. When the required --config flag is missing, it prints the
|
||||
// returns a *CLIArgs. When the required -config flag is missing, it prints the
|
||||
// usage and exits with status 2 (matching argparse's exit code).
|
||||
func Parse() *CLIArgs {
|
||||
args := &CLIArgs{}
|
||||
@@ -34,19 +34,19 @@ func Parse() *CLIArgs {
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
|
||||
// --config maps to the legacy -c/--config (required), --init to -i/--init.
|
||||
// --username/--password replace the legacy interactive GetUsernamePassword
|
||||
// -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.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()
|
||||
|
||||
// The standard flag package has no built-in "required", so validate manually.
|
||||
if args.Config == "" {
|
||||
fmt.Fprintln(os.Stderr, "error: the required flag --config is not provided")
|
||||
fmt.Fprintln(os.Stderr, "error: the required flag -config is not provided")
|
||||
flag.Usage()
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user