Add godoc comments to exported symbols in remaining packages

Add documentation comments to exported symbols across all remaining
smaller packages including cmd/gen-docs, context, internal/browser,
internal/gh, internal/ghcmd, internal/ghinstance, internal/ghrepo,
internal/keyring, internal/run, internal/safepaths, internal/tableprinter,
internal/text, internal/update, pkg/cmd/accessibility, pkg/cmd/actions,
pkg/cmd/alias, pkg/cmd/api, pkg/cmd/browse, pkg/cmd/cache,
pkg/cmd/completion, pkg/cmd/copilot, pkg/cmd/factory, pkg/cmd/gpg-key,
pkg/cmd/label, pkg/cmd/licenses, pkg/cmd/org, pkg/cmd/preview,
pkg/cmd/ssh-key, pkg/cmd/version, pkg/extensions, pkg/jsoncolor,
pkg/markdown, pkg/option, pkg/set, pkg/ssh, pkg/surveyext, test,
internal/authflow, and utils.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Kynan Ware 2026-03-04 16:14:20 -07:00
parent df295a1dba
commit b8ee5c5eba
66 changed files with 178 additions and 0 deletions

View file

@ -30,6 +30,7 @@ type cmdWithStderr struct {
*exec.Cmd
}
// Output runs the cmdWithStderr and returns its output.
func (c cmdWithStderr) Output() ([]byte, error) {
if isVerbose, _ := utils.IsDebugEnabled(); isVerbose {
_ = printArgs(os.Stderr, c.Cmd.Args)
@ -49,6 +50,7 @@ func (c cmdWithStderr) Output() ([]byte, error) {
return out, cmdErr
}
// Run executes the cmdWithStderr command.
func (c cmdWithStderr) Run() error {
if isVerbose, _ := utils.IsDebugEnabled(); isVerbose {
_ = printArgs(os.Stderr, c.Cmd.Args)
@ -76,6 +78,7 @@ type CmdError struct {
Stderr *bytes.Buffer
}
// Error returns the error message for CmdError.
func (e CmdError) Error() string {
msg := e.Stderr.String()
if msg != "" && !strings.HasSuffix(msg, "\n") {
@ -84,6 +87,7 @@ func (e CmdError) Error() string {
return fmt.Sprintf("%s%s: %s", msg, e.Args[0], e.Err)
}
// Unwrap returns the underlying error for CmdError.
func (e CmdError) Unwrap() error {
return e.Err
}

View file

@ -12,6 +12,7 @@ const (
gitAuthRE = `-c credential(?:\..+)?\.helper= -c credential(?:\..+)?\.helper=!"[^"]+" auth git-credential `
)
// T defines the interface for t.
type T interface {
Helper()
Errorf(string, ...interface{})
@ -96,6 +97,7 @@ func (cs *CommandStubber) find(args []string) *commandStub {
return nil
}
// CommandCallback is a function that handles command execution in stubs.
type CommandCallback func([]string)
type commandStub struct {
@ -111,10 +113,12 @@ type errWithExitCode struct {
exitCode int
}
// Error returns the error message for errWithExitCode.
func (e errWithExitCode) Error() string {
return e.message
}
// ExitCode returns the exit code of the command.
func (e errWithExitCode) ExitCode() int {
return e.exitCode
}