config

package
v1.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandVersion  = "version"
	CommandLogin    = "login"
	CommandLogout   = "logout"
	CommandSessions = "sessions"
	CommandWhoami   = "whoami"
	CommandModels   = "models"
	CommandServe    = "serve"
	CommandImport   = "import"
)

Known subcommand names captured in AppConfig.Command after ParseConfig.

Variables

View Source
var ErrHelpRequested = errors.New("help requested")

ErrHelpRequested is returned when the user asked for command help. Callers should exit successfully after cobra has printed help.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Verbose     bool
	ShowVersion bool

	// Command is the selected subcommand name (see Command* constants).
	// Bare root defaults to CommandServe.
	Command string
	// Args are positional args passed to the selected subcommand.
	Args []string

	Host         string
	Port         int
	AuthPath     string
	MaxRetries   int
	CooldownMins int
	PreferPro    bool
	// MaxLoginAttempts caps concurrent open Control API login attempts.
	MaxLoginAttempts int
	// LoginAttemptMins closes unanswered login attempts after this many minutes.
	LoginAttemptMins int
	// LoginKeepMins keeps a resolved login attempt listed after success/fail.
	LoginKeepMins int

	// SessionsCheck is set by `sessions --check`.
	SessionsCheck bool
	// ImportPath is the Cursor-style auth.json path for `import` (default ./data/auth.json).
	ImportPath string
}

func ParseConfig

func ParseConfig(displayName, shortName string) (*AppConfig, error)

ParseConfig loads env defaults, parses CLI flags/subcommands, and returns the app config. It returns ErrHelpRequested when the user asked for help (cobra has already printed it). Callers should handle ShowVersion and process exit themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL