config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ergomcutool version
	Version = "1.1.0"

	// Owner, group: r+w, others: read only
	DefaultFilePermissions uint32 = 0664

	// Special script permissions that allow execution
	DefaultScriptPermissions uint32 = 0775

	// Owner and group: full access, others: can't create new files
	DefaultDirPermissions uint32 = 0775

	// User-global ergomcutool configuration
	ToolConfig = &ToolConfigT{}

	UserConfigFileName = "ergomcutool_config.yaml"

	UserConfigFilePath = filepath.Join(UserConfigDir, UserConfigFileName)

	// Number of makefile backup files
	MakefileBackupsLimit = 5

	LocalErgomcuDir = "ergomcutool"

	// ProjectFilePath is the path to the project file from project root.
	ProjectFilePath   = filepath.Join(LocalErgomcuDir, "ergomcu_project.yaml")
	ProjectScriptsDir = filepath.Join(LocalErgomcuDir, "scripts")
)
View Source
var UserConfigDir = func() string {
	homeDir, _ := os.UserHomeDir()
	return filepath.Join(homeDir, ".ergomcutool")
}()

user and local tool configuration file names

Functions

func CheckUserConfigDirExists

func CheckUserConfigDirExists() bool

func CreateUserConfig

func CreateUserConfig() error

CreateUserConfig creates user config directory and its contents. If the directory already exists, it returns error.

func EnsureUserConfigExists

func EnsureUserConfigExists()

EnsureUserConfigExists checks that ergomcutool user config directory exists. If not, it prints error message and exists with an error.

func ParseErgomcutoolConfig

func ParseErgomcutoolConfig(createLocalConfigIfNotExists bool)

ParseErgomcutoolConfig parses ergomcutool configuration, both user and local configurations are taken into account. 'createLocalConfigIfNotExists': if true, creates a local configuration file in CWD that is a commented-out copy of the current user configuration.

Types

type BuildOptionsT

type BuildOptionsT struct {
	BuildDir          *string `yaml:"build_dir"`
	Debug             *string `yaml:"debug"`
	OptimizationFlags *string `yaml:"optimization_flags"`
}

func (*BuildOptionsT) Validate

func (o *BuildOptionsT) Validate() error

Validate validates the build options. Currently, nil values are considered legitimate.

type ExternalDependencyT

type ExternalDependencyT struct {
	Var                 string `yaml:"var"`
	Path                string `yaml:"path"`
	CreateInProjectLink bool   `yaml:"create_in_project_link"`
	LinkName            string `yaml:"link_name"`
}

func (*ExternalDependencyT) MergeSpecial

func (projectSetting *ExternalDependencyT) MergeSpecial(
	configSetting *ExternalDependencyT)

MergeSpecial merges two external dependencies. 'projectSetting' is supposed to be from the project configuration, and 'configSetting' - from the tool configuration. 'Var' fields are supposed to be equal and are not modified. 'projectSetting.CreateInProjectLink' is only modified if 'configSetting.CreateInProjectLink==true' Precedence has: 'configSetting.Path', 'projectSetting.LinkName' is only modified if 'configSetting.LinkName' is not empty.

func (*ExternalDependencyT) Validate

func (g *ExternalDependencyT) Validate() error

Validate validates the external dependency.

type IntellisenseT added in v1.1.0

type IntellisenseT struct {
	IgnoreExternalMakefileOptions bool `yaml:"ignore_external_makefile_sources"`
}

func (*IntellisenseT) Validate added in v1.1.0

func (o *IntellisenseT) Validate() error

Validate validates the IntellisenseT options.

type ToolConfigT

type ToolConfigT struct {
	General              *ToolConfig_GeneralT  `yaml:"general"`
	Openocd              *ToolConfig_OpenOcdT  `yaml:"openocd"`
	ExternalDependencies []ExternalDependencyT `yaml:"external_dependencies"`
	BuildOptions         *BuildOptionsT        `yaml:"build_options"`
	Intellisense         IntellisenseT         `yaml:"intellisense"`
}

func (*ToolConfigT) String

func (g *ToolConfigT) String() string

type ToolConfig_GeneralT

type ToolConfig_GeneralT struct {
	ArmToolchainPath *string `yaml:"arm_toolchain_path"`
	CCompilerPath    *string `yaml:"c_compiler_path"`
	CppCompilerPath  *string `yaml:"cpp_compiler_path"`
	DebuggerPath     *string `yaml:"debugger_path"`
}

func (*ToolConfig_GeneralT) Validate

func (g *ToolConfig_GeneralT) Validate() error

type ToolConfig_OpenOcdT

type ToolConfig_OpenOcdT struct {
	Interface   *string `yaml:"interface"`
	BinPath     *string `yaml:"bin_path"`
	ScriptsPath *string `yaml:"scripts_path"`
	SvdFilePath string  `yaml:"svd_file_path"`
}

func (*ToolConfig_OpenOcdT) Validate

func (g *ToolConfig_OpenOcdT) Validate() error

Jump to

Keyboard shortcuts

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