Documentation ¶
Overview ¶
Package gh is a library for CLI Go applications to help interface with the gh CLI tool, and the GitHub API.
Note that the examples in this package assume gh and git are installed. They do not run in the Go Playground used by pkg.go.dev.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Exec ¶
Exec invokes a gh command in a subprocess and captures the output and error streams.
Example ¶
Execute 'gh issue list -R cli/cli', and print the output.
package main import ( "fmt" "log" gh "github.com/cli/go-gh/v2" ) func main() { args := []string{"issue", "list", "-R", "cli/cli"} stdOut, stdErr, err := gh.Exec(args...) if err != nil { log.Fatal(err) } fmt.Println(stdOut.String()) fmt.Println(stdErr.String()) }
Output:
func ExecContext ¶
ExecContext invokes a gh command in a subprocess and captures the output and error streams.
func ExecInteractive ¶
Exec invokes a gh command in a subprocess with its stdin, stdout, and stderr streams connected to those of the parent process. This is suitable for running gh commands with interactive prompts.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
yamlmap
Package yamlmap is a wrapper of gopkg.in/yaml.v3 for interacting with yaml data as if it were a map.
|
Package yamlmap is a wrapper of gopkg.in/yaml.v3 for interacting with yaml data as if it were a map. |
pkg
|
|
api
Package api is a set of types for interacting with the GitHub API.
|
Package api is a set of types for interacting with the GitHub API. |
asciisanitizer
Package asciisanitizer implements an ASCII control character sanitizer for UTF-8 strings.
|
Package asciisanitizer implements an ASCII control character sanitizer for UTF-8 strings. |
auth
Package auth is a set of functions for retrieving authentication tokens and authenticated hosts.
|
Package auth is a set of functions for retrieving authentication tokens and authenticated hosts. |
browser
Package browser facilitates opening of URLs in a web browser.
|
Package browser facilitates opening of URLs in a web browser. |
config
Package config is a set of types for interacting with the gh configuration files.
|
Package config is a set of types for interacting with the gh configuration files. |
jq
Package jq facilitates processing of JSON strings using jq expressions.
|
Package jq facilitates processing of JSON strings using jq expressions. |
jsonpretty
Package jsonpretty implements a terminal pretty-printer for JSON.
|
Package jsonpretty implements a terminal pretty-printer for JSON. |
markdown
Package markdown facilitates rendering markdown in the terminal.
|
Package markdown facilitates rendering markdown in the terminal. |
prompter
Package prompter provides various methods for prompting the user with questions for input.
|
Package prompter provides various methods for prompting the user with questions for input. |
repository
Package repository is a set of types and functions for modeling and interacting with GitHub repositories.
|
Package repository is a set of types and functions for modeling and interacting with GitHub repositories. |
ssh
Package ssh resolves local SSH hostname aliases.
|
Package ssh resolves local SSH hostname aliases. |
tableprinter
Package tableprinter facilitates rendering column-formatted data to a terminal and TSV-formatted data to a script or a file.
|
Package tableprinter facilitates rendering column-formatted data to a terminal and TSV-formatted data to a script or a file. |
template
Package template facilitates processing of JSON strings using Go templates.
|
Package template facilitates processing of JSON strings using Go templates. |
term
Package term provides information about the terminal that the current process is connected to (if any), for example measuring the dimensions of the terminal and inspecting whether it's safe to output color.
|
Package term provides information about the terminal that the current process is connected to (if any), for example measuring the dimensions of the terminal and inspecting whether it's safe to output color. |
text
Package text is a set of utility functions for text processing and outputting to the terminal.
|
Package text is a set of utility functions for text processing and outputting to the terminal. |