Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterDefaults ¶ added in v0.7.0
func RegisterDefaults()
RegisterDefaults registers the default CEL environment, cache, and Go template factories required before calling Root(). Embedders that need the standard scafctl behaviour should call this once at startup. Individual factories can still be overridden afterwards by calling the corresponding Set*Factory functions directly.
func Root ¶
func Root(opts *RootOptions) *cobra.Command
Root creates and returns the root cobra.Command for the scafctl CLI tool. It sets up persistent flags, configures logging, handles profiler options, validates command arguments, and adds subcommands. The command provides configuration discovery and scaffolding functionality.
opts may be nil, in which case production defaults are used. Each invocation creates its own isolated state so multiple Root() calls can execute concurrently without data races.
Types ¶
type RootOptions ¶ added in v0.3.0
type RootOptions struct {
// IOStreams overrides the default os.Stdin/Stdout/Stderr streams.
// When nil, standard OS streams are used.
IOStreams *terminal.IOStreams
// ExitFunc overrides os.Exit. When non-nil it is passed through
// writer.WithExitFunc so that ErrorWithCode/ErrorWithExit call
// this function instead of terminating the process. Useful for
// in-process test execution where panicking or returning an error
// is preferred over killing the process.
ExitFunc func(code int)
// ConfigPath overrides the --config flag default.
ConfigPath string
// BinaryName overrides the default CLI binary name used by this command
// tree: root command Use field, subcommand Short descriptions, env var
// prefix, telemetry service name, and version output. Solution discovery
// and cache paths are wired through settings.Run.BinaryName.
// When empty, defaults to settings.CliBinaryName ("scafctl").
BinaryName string
// PreRunHook is called within PersistentPreRun after scafctl's standard
// setup (config, logger, auth, telemetry) is complete but before the
// command's own RunE executes. The context on cmd is fully initialized.
// When nil, no additional hook runs.
PreRunHook func(cmd *cobra.Command, args []string) error
// VersionExtra is additional version info displayed alongside scafctl's
// own version. When non-nil, the version command shows both the
// embedder's and scafctl's versions.
VersionExtra *settings.VersionInfo
// ConfigDefaults is an optional YAML byte slice providing embedder-level
// configuration defaults. These are merged after scafctl's built-in
// defaults but before the user's config file, environment variables,
// and CLI flags.
//
// Merge precedence (lowest to highest):
// 1. scafctl built-in defaults (setDefaults)
// 2. ConfigDefaults (this field)
// 3. User config file (~/.config/<binary>/config.yaml)
// 4. Environment variables
// 5. CLI flags
ConfigDefaults []byte
// AuthPluginDirs specifies directories to scan for auth handler plugin
// binaries. Discovered plugins are registered in the auth.Registry
// alongside built-in handlers during PersistentPreRunE.
AuthPluginDirs []string
// ActionDiscoveryFileNames overrides the file names used by "run action"
// auto-discovery. When empty, the defaults from
// settings.ActionFileNamesFor are used.
ActionDiscoveryFileNames []string
}
RootOptions configures a Root() invocation. All fields are optional; nil values use production defaults. Passing a non-nil RootOptions enables fully parallel in-process execution because each call to Root() creates its own isolated state.
func NewRootOptions ¶ added in v0.3.0
func NewRootOptions() *RootOptions
NewRootOptions returns a RootOptions with production defaults (nil IOStreams, nil ExitFunc, empty ConfigPath).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package auth provides CLI commands for authentication management.
|
Package auth provides CLI commands for authentication management. |
|
Package build provides the build command for packaging artifacts into the local catalog.
|
Package build provides the build command for packaging artifacts into the local catalog. |
|
Package bundle provides CLI commands for inspecting, verifying, and extracting solution bundles built by 'scafctl build solution'.
|
Package bundle provides CLI commands for inspecting, verifying, and extracting solution bundles built by 'scafctl build solution'. |
|
Package cache provides commands for managing the scafctl cache.
|
Package cache provides commands for managing the scafctl cache. |
|
Package catalog provides commands for inspecting and managing the local catalog.
|
Package catalog provides commands for inspecting and managing the local catalog. |
|
Package config provides commands for managing scafctl configuration.
|
Package config provides commands for managing scafctl configuration. |
|
Package credentialhelper implements the scafctl credential-helper CLI commands, exposing scafctl's encrypted credential store via the Docker credential helper protocol.
|
Package credentialhelper implements the scafctl credential-helper CLI commands, exposing scafctl's encrypted credential store via the Docker credential helper protocol. |
|
Package eval provides commands for evaluating and validating CEL expressions and Go templates.
|
Package eval provides commands for evaluating and validating CEL expressions and Go templates. |
|
Package examples provides commands for browsing and retrieving embedded scafctl examples.
|
Package examples provides commands for browsing and retrieving embedded scafctl examples. |
|
Package explain provides the CLI explain commands.
|
Package explain provides the CLI explain commands. |
|
Package lint provides the lint command for validating solutions.
|
Package lint provides the lint command for validating solutions. |
|
Package newcmd provides commands for creating new scafctl resources.
|
Package newcmd provides commands for creating new scafctl resources. |
|
Package plugins provides commands for managing scafctl plugins.
|
Package plugins provides commands for managing scafctl plugins. |
|
Package run provides the CLI run commands.
|
Package run provides the CLI run commands. |
|
Package secrets provides commands for managing scafctl secrets.
|
Package secrets provides commands for managing scafctl secrets. |
|
Package vendor provides CLI commands for managing vendored solution dependencies.
|
Package vendor provides CLI commands for managing vendored solution dependencies. |