{"modulePath":"github.com/mjun0812/github-metrics","version":"v1.2.13","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package pluginutil\n\nPackage pluginutil collects the small input-parsing and formatting helpers that nearly every plugin reimplements verbatim. Keep this file the single source of truth for those primitives so the per- plugin \\_.go files stay focused on their domain logic.\n\n## Constants\n\n```go\nconst ZeroSHA = \"0000000000000000000000000000000000000000\"\n```\nZeroSHA is the all-zero git object id GitHub returns on the create- branch \"before\" / delete-branch \"after\" sides of a PushEvent.\n\n## Functions\n\n```go\nfunc ExtrasEnabled(in map[string]any, key string) bool\n```\nExtrasEnabled gates a \"show by default unless the user explicitly turned it off\" toggle. Missing key (or nil map) means enabled.\n\n```go\nfunc IsZeroSHA(sha string) bool\n```\nIsZeroSHA reports whether sha is empty or the all-zero git OID (transient create/delete markers in events).\n\n```go\nfunc LoginFromInputs(in map[string]any) string\n```\nLoginFromInputs returns the GitHub login the plugin should act on: \\`user\\` first, then the upstream alias \\`login\\`. nil map returns \"\".\n\n```go\nfunc Plural(n int) string\n```\nPlural mirrors upstream's \\`s()\\` template helper: returns \"\" when n is 1, \"s\" otherwise. Use for English-style \"1 commit\" / \"2 commits\" labels.\n\n```go\nfunc ReadBool(in map[string]any, key string) bool\n```\nReadBool parses in\\[key] into a bool via the same rules as Truthy. Missing/unparsable returns false.\n\n```go\nfunc ReadBoolDefault(in map[string]any, key string, def bool) bool\n```\nReadBoolDefault parses in\\[key] into a bool. Missing key returns def; a present but unparsable value also returns def (mirrors the legacy per-plugin behavior — a literal \"off\"/\"no\" string evaluates as !Truthy and therefore yields def, which matches upstream's \"any unrecognized value means default\" semantics).\n\n```go\nfunc ReadCSV(in map[string]any, key string) []string\n```\nReadCSV parses in\\[key] as a comma-separated list. Accepts \\[]string, \\[]any, and string. Empty/whitespace-only entries are dropped.\n\n```go\nfunc ReadCSVValue(v any) []string\n```\nReadCSVValue is ReadCSV's single-value form, for callers that have already pulled the value out of the map (or get it from elsewhere).\n\n```go\nfunc ReadInt(in map[string]any, key string) (int, bool)\n```\nReadInt parses in\\[key] into an int, accepting Go ints, int64, float64 (the YAML loader's default for numerics), and base-10 strings.\n\n```go\nfunc ReadIntDefault(in map[string]any, key string, def int) int\n```\nReadIntDefault returns ReadInt's value or def when the key is missing or unparsable.\n\n```go\nfunc TrimEmpty(in []string) []string\n```\nTrimEmpty strips leading/trailing whitespace from each entry and drops the ones that collapse to empty.\n\n```go\nfunc Truthy(v any) bool\n```\nTruthy collapses the input-map's any to a bool. Accepts bool, the strings \"true\"/\"1\"/\"yes\" (case-insensitive, whitespace-trimmed), and non-zero numerics. Mirrors upstream metadata.mjs's \\`descriptor.type === \"boolean\"\\` parsing — the action YAML loader normalizes bools, but tests and direct callers may still pass raw strings.\n\n```go\nfunc TruthyInput(in map[string]any, key string) bool\n```\nTruthyInput is Truthy applied to in\\[key]. A nil map or missing key returns false.\n\n","path":"github.com/mjun0812/github-metrics/internal/plugins/pluginutil","name":"pluginutil","synopsis":"Package pluginutil collects the small input-parsing and formatting helpers that nearly every plugin reimplements verbatim.","isRedistributable":true}
