gh

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package gh implements the "safe gh" wrapper: it parses a gh argv and reports invocations outside a narrow allowlist so the command layer can refuse them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(argv []string) []safe.Violation

Check parses argv and returns a safe.Violation when the invocation is refused, or nil when it is allowed. Refusal is fail-closed: only in-scope commands and their explicitly allowlisted verbs pass. Help-only invocations are allowed.

Types

type Invocation

type Invocation struct {
	Global     []string
	Command    string
	Subcommand string
	Args       []string
}

Invocation is a gh command line split into any options that appear before the command, the command (primary resource, e.g. "pr"), the subcommand (verb, e.g. "list"), and the verb's remaining arguments.

func Parse

func Parse(argv []string) Invocation

Parse splits argv into leading options, the command, the subcommand, and the subcommand's args. Leading options are kept (fail closed) so an unknown option cannot be mistaken for the command; the subcommand is the first non-option token after the command, so an option wedged before the verb cannot hide it.

Jump to

Keyboard shortcuts

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