package cli import ( "context" "fmt" "io" "gitea.maximumdirect.net/eric/distributor/internal/app" ) var serveApp = app.Serve func serveCommand(ctx context.Context, args []string, stdout, stderr io.Writer) int { if hasHelp(args) { printServeHelp(stdout) return exitOK } flags := newFlagSet("serve", stderr) configPath := flags.String("config", "", "path to config file") if err := flags.Parse(args); err != nil { return exitUsage } if rejectPositionalArgs(stderr, "serve", flags.Args()) { return exitUsage } if err := serveApp(ctx, app.ServeOptions{ConfigPath: *configPath}); err != nil { return fail(stderr, err) } return exitOK } func printServeHelp(w io.Writer) { fmt.Fprint(w, `Usage: distributor serve --config Options: --config Path to config file Serve loads configured HTTP upload sources, resolves upload tokens through the configured secret environment, and starts the HTTP upload API. `) }