hook

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package hook runs user-defined lifecycle scripts by convention.

Scripts live under $HOME/<ConfigPath>/hooks/ (e.g. ~/.ws/hooks/post-add) and are opt-in: if the script doesn't exist it's silently skipped. Context is passed to the script purely through environment variables (WS_* keys), so the script can do whatever it wants without ws needing to know about it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(hookName string, env map[string]string, workDir string)

Run executes a "post-*" convention hook (e.g. "post-add"). A missing hook is skipped silently and any failure is reported to stderr but never aborts ws, since the main operation has already completed by the time it runs.

func RunPre

func RunPre(hookName string, env map[string]string, workDir string) error

RunPre executes a "pre-*" convention hook (e.g. "pre-add") and returns its error so the caller can abort the operation when the hook fails. A missing hook returns nil (nothing to gate).

Types

This section is empty.

Jump to

Keyboard shortcuts

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