cmd

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Types

type CheckResult

type CheckResult struct {
	ForecastTime time.Duration
	FilePath     string
	Error        error
}

type CheckerConfig

type CheckerConfig struct {
	DataConfigDir   string   `yaml:"data_config_dir" flag:"data-config-dir"`
	DataConfigFile  string   `yaml:"data_config_file" flag:"data-config-file"`
	DataType        string   `yaml:"data_type" flag:"data-type"`
	LocationLevels  string   `yaml:"location_levels" flag:"location-level"`
	MaxCheckCount   int      `yaml:"max_check_count" flag:"max-check-count"`
	CheckInterval   string   `yaml:"check_interval" flag:"check-interval"`
	DelayTime       string   `yaml:"delay_time" flag:"delay-time"`
	Debug           bool     `yaml:"debug" flag:"debug"`
	ForecastTimes   []string `yaml:"forecast_times"`
	ExecuteCommand  string   `yaml:"execute_command" flag:"execute-command"`
	ExecuteCommands []string `yaml:"execute_commands"`
}

CheckerConfig holds runtime options for the data_checker local command. It is intentionally separate from the data path config (DataConfig).

The `flag` tag maps a struct field to its CLI flag name. It is used by MergeCheckerConfig to decide whether a CLI flag should override the YAML value.

func DefaultCheckerConfig

func DefaultCheckerConfig() CheckerConfig

DefaultCheckerConfig returns the default runtime configuration. These values match the CLI flag defaults registered in local.go.

func LoadCheckerConfig

func LoadCheckerConfig(filePath string) (CheckerConfig, error)

LoadCheckerConfig loads a runtime checker config from a YAML file.

func MergeCheckerConfig

func MergeCheckerConfig(fileConfig CheckerConfig, flagConfig CheckerConfig, cmd *cobra.Command) (CheckerConfig, error)

MergeCheckerConfig combines a YAML file config with CLI flag values. CLI flags always override values from the YAML file. The result is validated before being returned.

func (CheckerConfig) ParseForecastTimes

func (c CheckerConfig) ParseForecastTimes() ([]time.Duration, error)

ParseForecastTimes converts string forecast times (e.g. "6h", "001h10m") into time.Duration values using the same parser as stdin input.

func (CheckerConfig) Validate

func (c CheckerConfig) Validate() error

Validate returns an error if the config is missing required fields or contains incompatible settings.

type CheckerTemplateVariable

type CheckerTemplateVariable struct {
	common.ConfigTemplateVariable
	FilePath string
}

Jump to

Keyboard shortcuts

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