root

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoShow = ShowFuncType(func() func(any) {
	return nil
})

NoShow is a constant that represents a ShowFuncType that returns nil, meaning no output will be shown.

Functions

func Flags

func Flags(cmd *cobra.Command)

Flags adds the flags for the `godyl` root command to the provided Cobra command.

Types

type Cache

type Cache struct {
	// Path to cache folder
	Dir folder.Folder `mapstructure:"cache-dir" yaml:"cache-dir"`

	// Disabled disables cache interaction
	Disabled bool `mapstructure:"no-cache" yaml:"no-cache"`
}

Cache holds the configuration options for caching.

type Config

type Config struct {
	/* Subcommands */
	// Dump contains the configuration for the `godyl dump` command
	Dump dump.Dump `mapstructure:"dump" validate:"-" yaml:"dump"`

	// Update contains the configuration for the `godyl update` command
	Update update.Update `mapstructure:"update" validate:"-" yaml:"update"`

	// Status contains the configuration for the `godyl status` command
	Status status.Status `mapstructure:"status" validate:"-" yaml:"status"`

	// Download contains the configuration for the `godyl download` command
	Download download.Download `mapstructure:"download" validate:"-" yaml:"download"`

	// Install contains the configuration for the `godyl install` command
	Install install.Install `mapstructure:"install" validate:"-" yaml:"install"`

	/* Flags */
	// Tokens store authentication tokens for various sources
	Tokens Tokens `mapstructure:",squash" yaml:",inline,flatten"`

	// Inherit specifies the default scheme to inherit from when no scheme is specified
	Inherit string `mapstructure:"inherit" yaml:"inherit"`

	// ErrorFile specifies the file to log errors
	ErrorFile file.File `mapstructure:"error-file" yaml:"error-file"`

	// Tools specifies the tools file to be used
	Tools string `mapstructure:"tools" yaml:"tools"`

	// Defaults specifies the default file to be used
	Defaults file.File `mapstructure:"defaults" yaml:"defaults"`

	// ConfigFile specifies the configuration file to be used
	ConfigFile file.File `mapstructure:"config-file" yaml:"config-file"`

	// LogLevel specifies the logging level
	LogLevel string `mapstructure:"log-level" validate:"oneof=silent debug info warn error always" yaml:"log-level"`

	// EnvFile specifies the environment files to be used
	EnvFile []file.File `mapstructure:"env-file" yaml:"env-file"`

	// Cache holds the cache configuration options
	Cache Cache `mapstructure:",squash" yaml:",inline,flatten"`

	// Parallel specifies the number of parallel operations
	Parallel int `mapstructure:"parallel" validate:"gte=0" yaml:"parallel"`

	// Verbose specifies the verbosity level
	Verbose int `mapstructure:"verbose" yaml:"verbose"`

	// Show specifies the verbosity level for showing output
	Show Verbosity `mapstructure:"show" yaml:"show"`

	// NoVerifySSL disables SSL verification
	NoVerifySSL bool `mapstructure:"no-verify-ssl" yaml:"no-verify-ssl"`

	// NoProgress disables progress indicators
	NoProgress bool `mapstructure:"no-progress" yaml:"no-progress"`

	// Keyring enables the use of the keyring for retrieving tokens
	Keyring bool `mapstructure:"keyring" yaml:"keyring"`

	/* Other Options */
	// Common contains a subset of common configuration options
	Common common.Common `mapstructure:"-" yaml:"-"`

	// Tracker embed the common tracker configuration, allowing to tracker
	// whether configuration values have been explicitly set or defaulted
	common.Tracker `mapstructure:"-" yaml:"-"`
}

Config holds the root level configuration options. It is split into sub-structs for each command.

func (Config) AllTokensSet

func (c Config) AllTokensSet() bool

AllTokensSet checks if all of the tokens are set.

func (*Config) ShowFunc

func (c *Config) ShowFunc() func(any)

ShowFunc returns the function to be used for showing the output based on the Verbosity level.

func (*Config) ToTool

func (c *Config) ToTool(forced bool) *tool.Tool

ToTool converts the Config to a tool.Tool instance, holding either default values or values set by the user.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the root configuration for correctness.

type ShowFuncType

type ShowFuncType func() func(any)

ShowFuncType declares the type for the ShowFunc function.

type Tokens

type Tokens struct {
	// GitHub token for authentication
	GitHub string `mapstructure:"github-token" mask:"fixed" yaml:"github-token"`

	// GitLab token for authentication
	GitLab string `mapstructure:"gitlab-token" mask:"fixed" yaml:"gitlab-token"`

	// URL token for authentication
	URL string `mapstructure:"url-token" mask:"fixed" yaml:"url-token"`
}

Tokens holds the configuration options for authentication tokens.

type Verbosity

type Verbosity int

Verbosity controls the level of output shown to the user in the ShowFunc function.

const (
	// None means no output.
	None Verbosity = iota
	// Masked means masked output.
	Masked
	// Default means unmasked output.
	Default
)

Jump to

Keyboard shortcuts

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