Use go-gh to author GitHub CLI extensions
trunkgo-gh is a collection of Go modules designed to simplify the creation of GitHub CLI extensions. By using this library, your extension will automatically follow standard GitHub CLI conventions:
- Repository Context:
repository.Current()respects theGH_REPOenvironment variable and falls back to git remote configuration. - Authentication: GitHub API requests use the same authentication mechanism as the
ghCLI, utilizingGH_TOKENandGH_HOSTenvironment variables or the user's stored OAuth token. - Terminal Capabilities: Terminal features are determined by standard environment variables like
GH_FORCE_TTY,NO_COLOR, andCLICOLOR. - Output Formatting: Table generation (
tableprinter) and Go template output (template) use the same engines as theghCLI. - Browser Integration: The
browsermodule uses the user's preferred web browser.