Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFencedCB ¶
AddFencedCB addresses MD040 issues found with markdownlint by adding the input language to fenced code blocks in the input filePath.
Parameters:
filePath: A string representing the path to the markdown file to modify. language: A string representing the language to be added to the fenced code block.
Returns:
error: An error if the markdown file fails to be modified.
Example:
err := AddFencedCB("/path/to/markdown/file", "go")
if err != nil {
log.Fatalf("Error modifying markdown file: %v", err)
}
func ClearPCCache ¶
func ClearPCCache() error
ClearPCCache clears the pre-commit cache.
Returns:
error: An error if the cache fails to clear.
Example:
err := ClearPCCache()
if err != nil {
log.Fatalf("Error clearing cache: %v", err)
}
func InstallGoPCDeps ¶
func InstallGoPCDeps() error
InstallGoPCDeps installs dependencies used for pre-commit with Golang projects.
Returns:
error: An error if the dependencies fail to install.
Example:
err := InstallGoPCDeps()
if err != nil {
log.Fatalf("Error installing dependencies: %v", err)
}
func InstallPCHooks ¶
func InstallPCHooks() error
InstallPCHooks installs pre-commit hooks locally.
Returns:
error: An error if the hooks fail to install.
Example:
err := InstallPCHooks()
if err != nil {
log.Fatalf("Error installing hooks: %v", err)
}
func RunPCHooks ¶
RunPCHooks runs pre-commit hooks with a provided timeout. If no timeout is provided, it defaults to 600.
Parameters:
timeout (optional): An integer specifying the timeout duration for running pre-commit hooks.
Returns:
error: An error if the pre-commit hook execution fails.
Example:
err := RunPCHooks() // Runs with a default timeout of 600.
if err != nil {
log.Fatalf("Failed to run pre-commit hooks: %v", err)
}
err = RunPCHooks(300) // Runs with a specified timeout of 300.
if err != nil {
log.Fatalf("Failed to run pre-commit hooks: %v", err)
}
func UpdatePCHooks ¶
func UpdatePCHooks() error
UpdatePCHooks updates pre-commit hooks locally.
Returns:
error: An error if the hooks fail to update.
Example:
err := UpdatePCHooks()
if err != nil {
log.Fatalf("Error updating hooks: %v", err)
}
Types ¶
This section is empty.