cli

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorHelpPrinter

func ColorHelpPrinter(options kong.HelpOptions, ctx *kong.Context) error

ColorHelpPrinter is a kong.HelpPrinter that outputs colored help text.

func RunConfigApply

func RunConfigApply(ctx context.Context, globals *Globals, configDir string, extraFiles []string, fetcher configFetcher, applier apply.Applier, out io.Writer) error

RunConfigApply is the testable core of `config apply`.

func RunConfigDelete

func RunConfigDelete(ctx context.Context, globals *Globals, path string, deleter configDeleter, out io.Writer) error

RunConfigDelete validates the path, checks confirm/dry-run, and calls the deleter. In dry-run mode (default when --confirm is not set), it writes a preview message to out and returns nil. Pass out=nil to use os.Stdout.

func RunConfigDiff

func RunConfigDiff(ctx context.Context, globals *Globals, configDir string, extraFiles []string, fetcher configFetcher, out io.Writer) error

RunConfigDiff is the testable core of `config diff`.

func RunConfigGet

func RunConfigGet(ctx context.Context, globals *Globals, path string, fetcher configFetcher, out io.Writer) error

RunConfigGet is the testable core of `config get`.

func RunConfigInit

func RunConfigInit(ctx context.Context, dir, project, environment string, fetcher configFetcher, out io.Writer) error

RunConfigInit is the testable core of `config init`.

func RunConfigSet

func RunConfigSet(ctx context.Context, globals *Globals, path, value string, setter configSetter, out io.Writer) error

RunConfigSet validates the path, checks confirm/dry-run, and calls the setter. In dry-run mode (default when --confirm is not set), it writes a preview message to out and returns nil. Pass out=nil to use os.Stdout.

func RunEnvironmentList

func RunEnvironmentList(ctx context.Context, globals *Globals, projectID string, lister environmentLister, out io.Writer) error

RunEnvironmentList is the testable core of `environment list`.

func RunProjectList

func RunProjectList(ctx context.Context, globals *Globals, lister projectLister, out io.Writer) error

RunProjectList is the testable core of `project list`.

func RunWorkspaceList

func RunWorkspaceList(ctx context.Context, globals *Globals, lister workspaceLister, out io.Writer) error

RunWorkspaceList is the testable core of `workspace list`.

Types

type AuthCmd

type AuthCmd struct {
	Login  AuthLoginCmd  `cmd:"" help:"Log in to Railway via browser-based OAuth."`
	Logout AuthLogoutCmd `cmd:"" help:"Clear stored credentials."`
	Status AuthStatusCmd `cmd:"" help:"Show current authentication status."`
}

AuthCmd is the `auth` command group.

type AuthLoginCmd

type AuthLoginCmd struct{}

AuthLoginCmd implements `auth login`.

func (*AuthLoginCmd) Run

func (c *AuthLoginCmd) Run(globals *Globals) error

type AuthLogoutCmd

type AuthLogoutCmd struct{}

AuthLogoutCmd implements `auth logout`.

func (*AuthLogoutCmd) Run

func (c *AuthLogoutCmd) Run(globals *Globals) error

type AuthStatusCmd

type AuthStatusCmd struct{}

AuthStatusCmd implements `auth status`.

func (*AuthStatusCmd) Run

func (c *AuthStatusCmd) Run(globals *Globals) error

type CLI

type CLI struct {
	Globals `kong:"embed"`

	Version kong.VersionFlag `help:"Print version." short:"V"`

	// Subcommand groups
	Auth        AuthCmd        `cmd:"" help:"Manage authentication."`
	Config      ConfigCmd      `cmd:"" name:"config" help:"Declarative configuration management."`
	Project     ProjectCmd     `cmd:"" help:"Manage projects."`
	Environment EnvironmentCmd `cmd:"" help:"Manage environments."`
	Workspace   WorkspaceCmd   `cmd:"" help:"Manage workspaces."`
}

CLI is the root struct for the kong CLI parser. Global flags come from the embedded Globals; subcommand groups are nested structs.

type ConfigApplyCmd

type ConfigApplyCmd struct{}

func (*ConfigApplyCmd) Run

func (c *ConfigApplyCmd) Run(globals *Globals) error

Run implements `config apply`.

type ConfigCmd

type ConfigCmd struct {
	Init     ConfigInitCmd     `cmd:"" help:"Bootstrap a fat-controller.toml from live Railway state."`
	Get      ConfigGetCmd      `cmd:"" help:"Fetch live config from Railway."`
	Set      ConfigSetCmd      `cmd:"" help:"Set a single value by dot-path."`
	Delete   ConfigDeleteCmd   `cmd:"" help:"Delete a single value by dot-path."`
	Diff     ConfigDiffCmd     `cmd:"" help:"Compare local config against live state."`
	Apply    ConfigApplyCmd    `cmd:"" help:"Push configuration changes to Railway."`
	Validate ConfigValidateCmd `cmd:"" hidden:"" help:"Check config file for warnings (no API calls)."`
}

ConfigCmd is the `config` command group.

type ConfigDeleteCmd

type ConfigDeleteCmd struct {
	Path string `arg:"" required:"" help:"Dot-path to delete (e.g. api.variables.OLD)."`
}

ConfigDeleteCmd implements `config delete`.

func (*ConfigDeleteCmd) Run

func (c *ConfigDeleteCmd) Run(globals *Globals) error

Run implements `config delete`.

type ConfigDiffCmd

type ConfigDiffCmd struct{}

func (*ConfigDiffCmd) Run

func (c *ConfigDiffCmd) Run(globals *Globals) error

Run implements `config diff`.

type ConfigGetCmd

type ConfigGetCmd struct {
	Path string `arg:"" optional:"" help:"Dot-path to fetch (e.g. api.variables.PORT). Omit for all."`
	// contains filtered or unexported fields
}

ConfigGetCmd implements `config get`.

func (*ConfigGetCmd) Run

func (c *ConfigGetCmd) Run(globals *Globals) error

Run implements `config get`.

func (*ConfigGetCmd) SetOutput

func (c *ConfigGetCmd) SetOutput(w io.Writer)

SetOutput overrides the output writer (for testing).

type ConfigInitCmd

type ConfigInitCmd struct{}

func (*ConfigInitCmd) Run

func (c *ConfigInitCmd) Run(globals *Globals) error

Run implements `config init`.

type ConfigSetCmd

type ConfigSetCmd struct {
	Path  string `arg:"" required:"" help:"Dot-path to set (e.g. api.variables.PORT)."`
	Value string `arg:"" required:"" help:"Value to set."`
}

ConfigSetCmd implements `config set`.

func (*ConfigSetCmd) Run

func (c *ConfigSetCmd) Run(globals *Globals) error

Run implements `config set`.

type ConfigValidateCmd

type ConfigValidateCmd struct{}

func (*ConfigValidateCmd) Run

func (c *ConfigValidateCmd) Run(globals *Globals) error

type EnvironmentCmd

type EnvironmentCmd struct {
	List EnvironmentListCmd `cmd:"" help:"List environments for a project."`
}

type EnvironmentInfo

type EnvironmentInfo struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

EnvironmentInfo is a simplified environment record for display.

type EnvironmentListCmd

type EnvironmentListCmd struct{}

func (*EnvironmentListCmd) Run

func (c *EnvironmentListCmd) Run(globals *Globals) error

Run implements `environment list`. Requires --project flag (or env var) to know which project to list environments for.

type Globals

type Globals struct {
	Token       string        `` /* 150-byte string literal not displayed */
	Workspace   string        `help:"Workspace ID or name." env:"FAT_CONTROLLER_WORKSPACE"`
	Project     string        `help:"Project ID or name." env:"FAT_CONTROLLER_PROJECT"`
	Environment string        `help:"Environment name." env:"FAT_CONTROLLER_ENVIRONMENT"`
	Output      string        `help:"Output format: text, json, toml." enum:"text,json,toml" default:"text" short:"o" env:"FAT_CONTROLLER_OUTPUT"`
	Color       string        `help:"Color mode: auto, always, never." enum:"auto,always,never" default:"auto" env:"FAT_CONTROLLER_COLOR"`
	Timeout     time.Duration `help:"API request timeout." default:"30s" env:"FAT_CONTROLLER_TIMEOUT"`
	Confirm     bool          `help:"Auto-execute mutations (skip confirmation)." env:"FAT_CONTROLLER_CONFIRM"`
	DryRun      bool          `help:"Force preview of mutations." name:"dry-run" env:"FAT_CONTROLLER_DRY_RUN"`
	ConfigFiles []string      `help:"Railway config file paths. Repeatable." name:"config" short:"c" env:"FAT_CONTROLLER_CONFIG" sep:"none"`
	Service     string        `help:"Scope to a single service." env:"FAT_CONTROLLER_SERVICE"`
	SkipDeploys bool          `help:"Don't trigger redeployments." name:"skip-deploys" env:"FAT_CONTROLLER_SKIP_DEPLOYS"`
	FailFast    bool          `help:"Stop on first error during apply." name:"fail-fast" env:"FAT_CONTROLLER_FAIL_FAST"`
	ShowSecrets bool          `help:"Show secret values instead of masking." name:"show-secrets" env:"FAT_CONTROLLER_SHOW_SECRETS"`
	Full        bool          `help:"Include IDs and read-only fields (get only)."`
	Verbose     bool          `help:"Debug output (HTTP requests, timing)." short:"v"`
	Quiet       bool          `help:"Suppress informational output." short:"q"`
}

Globals holds values that are available to every command's Run() method. Kong tags are here so CLI can embed Globals directly.

type ProjectCmd

type ProjectCmd struct {
	List ProjectListCmd `cmd:"" help:"List available projects."`
}

type ProjectInfo

type ProjectInfo struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

ProjectInfo is a simplified project record for display.

type ProjectListCmd

type ProjectListCmd struct{}

func (*ProjectListCmd) Run

func (c *ProjectListCmd) Run(globals *Globals) error

Run implements `project list`.

type WorkspaceCmd

type WorkspaceCmd struct {
	List WorkspaceListCmd `cmd:"" help:"List available workspaces."`
}

type WorkspaceInfo

type WorkspaceInfo struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

WorkspaceInfo is a simplified workspace record for display.

type WorkspaceListCmd

type WorkspaceListCmd struct{}

func (*WorkspaceListCmd) Run

func (c *WorkspaceListCmd) Run(globals *Globals) error

Run implements `workspace list`.

Jump to

Keyboard shortcuts

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