Documentation
¶
Overview ¶
Package dotgen provides functions to parse and manipulate dotgen configurations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Kinds = []string{"alias", "function", "raw", "run"}
Kinds represents the supported command kinds.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
// Name is the name of the command.
Name string `yaml:"name"`
// Doc is the documentation string for the command.
Doc string `yaml:"doc,omitempty"`
// Cmd is the command to execute.
Cmd string `yaml:"cmd"`
// Kind is the type of command: "alias", "function", "raw", or "run".
Kind string `yaml:"kind,omitempty"`
// ExportTo is the path to export the command output.
ExportTo string `yaml:"export_to,omitempty"`
// Shell specifies the shells for which this command is applicable.
Shell []string `yaml:"shell,omitempty"`
// OS specifies the operating systems for which this command is applicable.
OS []string `yaml:"os,omitempty"`
// Exclude specifies whether to exclude this command from the output.
Exclude bool `yaml:"exclude,omitempty"`
// Timeout specifies the timeout for "run" commands.
Timeout string `yaml:"timeout,omitempty"`
}
Command represents a single command definition, which can be an alias or a function.
func (*Command) Export ¶
Export returns a string representation of the command, suitable for shell usage.
func (*Command) IsExcluded ¶
IsExcluded checks if the command should be excluded based on the provided OS and shell.
type Dotgen ¶
type Dotgen struct {
// Vars holds the variable definitions.
Vars Vars `yaml:"vars,omitempty"`
// Env holds the environment variable definitions.
Env Env `yaml:"env,omitempty"`
// Commands holds the command definitions.
Commands []Command `yaml:"commands,omitempty"`
}
Dotgen represents the root structure of an dotgen configuration file.
type Instrumentation ¶ added in v0.0.2
type Instrumentation struct {
// Name is the name of the Dotgen file being instrumented.
Name string
// Enabled indicates whether instrumentation is enabled.
Enabled bool
// contains filtered or unexported fields
}
Instrumentation represents the instrumentation configuration for a Dotgen file.
func Instrument ¶ added in v0.0.2
func Instrument(file string) Instrumentation
Instrument creates an Instrumentation instance for the given Dotgen file.
func (*Instrumentation) Disable ¶ added in v0.0.2
func (i *Instrumentation) Disable()
Disable disables the instrumentation.
func (Instrumentation) Footer ¶ added in v0.0.2
func (i Instrumentation) Footer() string
Footer returns the footer section for instrumentation, including a summary of execution times.
func (Instrumentation) Header ¶ added in v0.0.2
func (i Instrumentation) Header() string
Header returns the header section for instrumentation.
func (Instrumentation) Wrap ¶ added in v0.0.2
func (i Instrumentation) Wrap(name, command string) string
Wrap wraps a command with instrumentation code to measure its execution time.