github

package
v1.0.1-0...-7e55529 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	RepoInfo(owner, name string) (RepoInfo, error)
	// Fork creates a fork and returns the fork's owner and name, which may
	// differ from the original if the repository was renamed.
	Fork(owner, name string) (forkOwner, forkName string, err error)
}

Client provides the GitHub API operations needed for fork decisions.

func NewClient

func NewClient() (Client, error)

NewClient creates a Client backed by the GitHub REST API.

type CloneTarget

type CloneTarget struct {
	Repository Repository
	Fork       *Repository
}

CloneTarget describes what to clone and how to configure remotes. When Fork is non-nil, Repository is the upstream and Fork is the user's fork.

func ResolveCloneTarget

func ResolveCloneTarget(owner, name string, fork *bool, client Client, prompter Prompter, diag io.Writer) (CloneTarget, error)

ResolveCloneTarget determines which repository to clone, forking if necessary.

fork controls forking behaviour:

  • nil — default: prompt when the user lacks write access
  • true — always fork (skip prompt); error if forking is disabled
  • false — never fork; clone the original directly without prompting

When a fork is created, CloneTarget.Fork is set; the caller should clone Repository as upstream and add Fork as origin.

diag receives verbose diagnostic messages; pass io.Discard to suppress them.

type Prompter

type Prompter interface {
	Confirm(prompt string, defaultValue bool) (bool, error)
}

Prompter can prompt the user for confirmation.

type RepoInfo

type RepoInfo struct {
	AllowForking  bool
	HasPushAccess bool
}

RepoInfo contains the fields from the GitHub API needed for fork decisions.

type Repository

type Repository struct {
	Owner string
	Name  string
}

func Parse

func Parse(definition string) (Repository, error)

Jump to

Keyboard shortcuts

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