Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Debug bool
var DryRun bool
var UserCommand string
Functions ¶
func Debugln ¶
func Debugln(format string, args ...interface{})
Debugln prints debug messages to stderr if Debug mode is enabled
func ParseParams ¶
func ParseParams()
ParseParams initializes the command-line flags and sets the global variables
Types ¶
type RepverCommand ¶
type RepverCommand struct {
// Name of the command
Name string `yaml:"name"`
// Targets is a list of files and patterns to modify
Targets []RepverTarget `yaml:"targets"`
// GitOptions configures Git operations to perform
GitOptions RepverGit `yaml:"git"`
}
func (*RepverCommand) GetParameterNames ¶
func (c *RepverCommand) GetParameterNames() ([]string, error)
GetParameterNames returns a list of all unique parameter names
func (*RepverCommand) Validate ¶
func (c *RepverCommand) Validate() error
Validate validates the RepverCommand structure
type RepverConfig ¶
type RepverConfig struct {
// Commands is an array of version modification commands
Commands []RepverCommand `yaml:"commands"`
}
func Load ¶
func Load(filePath string) (*RepverConfig, error)
Load reads a YAML file from the specified path and parses it into a RepverConfig structure
func Parse ¶
func Parse(yamlContent string) (*RepverConfig, error)
Parse takes a YAML string and parses it into a RepverConfig structure
func (*RepverConfig) GetCommand ¶
func (c *RepverConfig) GetCommand(name string) (*RepverCommand, error)
GetCommand returns a command by name; if not found, it returns an error
func (*RepverConfig) GetParameterNames ¶
func (c *RepverConfig) GetParameterNames() ([]string, error)
GetParameterNames returns a list of all unique parameter names
func (*RepverConfig) Validate ¶
func (c *RepverConfig) Validate() error
Validate validates the RepverConfig structure
type RepverGit ¶
type RepverGit struct {
// CreateBranch indicates whether to create a new branch
CreateBranch bool `yaml:"create_branch"`
// DeleteBranch indicates whether to delete the branch after execution
// Only used when ReturnToOriginalBranch is true
DeleteBranch bool `yaml:"delete_branch"`
// BranchName is the name for the new branch
BranchName string `yaml:"branch_name"`
// Commit indicates whether to commit changes
Commit bool `yaml:"commit"`
// CommitMessage is the message to use for the commit
CommitMessage string `yaml:"commit_message"`
// Push indicates whether to push changes
Push bool `yaml:"push"`
// Remote is the Git remote to push to
Remote string `yaml:"remote"`
// PullRequest specifies whether to open a PR (values: NO, GITHUB_CLI)
PullRequest string `yaml:"pull_request"`
// ReturnToOriginalBranch indicates whether to switch back to the original branch
ReturnToOriginalBranch bool `yaml:"return_to_original_branch"`
}
func (*RepverGit) BuildBranchName ¶
BuildBranchName builds the branch name by replacing placeholders with values
func (*RepverGit) BuildCommitMessage ¶
BuildCommitMessage builds the commit message by replacing placeholders with values
func (*RepverGit) GitOptionsSpecified ¶
GitOptionsSpecified checks if any Git options are specified
type RepverTarget ¶
type RepverTarget struct {
// Path to the target file
Path string `yaml:"path"`
// Pattern is the regex pattern to match content in the target file
Pattern string `yaml:"pattern"`
}
func (*RepverTarget) Execute ¶
func (t *RepverTarget) Execute(values map[string]string) (bool, error)
Execute performs the regex replacement on the file specified by Path. It reads the file, applies the regex pattern, and writes back the modified content. The values map contains the replacement values for named capture groups in the regex pattern. It returns true if the content was modified, false otherwise. In dry run mode, it outputs the changes that would be made without modifying the file. It returns an error if any issues occur during file reading, regex compilation, or writing.
func (*RepverTarget) GetParameterNames ¶
func (t *RepverTarget) GetParameterNames() ([]string, error)
GetParameterNames returns a list of all unique parameter names
func (*RepverTarget) Validate ¶
func (t *RepverTarget) Validate() error
Validate validates the RepverTarget structure