shared

package
v2.49.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthTokenWriteable added in v2.14.0

func AuthTokenWriteable(authCfg *config.AuthConfig, hostname string) (string, bool)

func GetCurrentLogin added in v2.40.0

func GetCurrentLogin(httpClient httpClient, hostname, authToken string) (string, error)

func GetScopes

func GetScopes(httpClient httpClient, hostname, authToken string) (string, error)

GetScopes performs a GitHub API request and returns the value of the X-Oauth-Scopes header.

func HasMinimumScopes

func HasMinimumScopes(httpClient httpClient, hostname, authToken string) error

HasMinimumScopes performs a GitHub API request and returns an error if the token used in the request lacks the minimum required scopes for performing API operations with gh.

func HeaderHasMinimumScopes added in v2.22.0

func HeaderHasMinimumScopes(scopesHeader string) error

HeaderHasMinimumScopes parses the comma separated scopesHeader string and returns an error if it lacks the minimum required scopes for performing API operations with gh.

func Login

func Login(opts *LoginOptions) error

Types

type GitCredentialFlow

type GitCredentialFlow struct {
	Executable string
	Prompter   Prompt
	GitClient  *git.Client
	// contains filtered or unexported fields
}

func (*GitCredentialFlow) Prompt

func (flow *GitCredentialFlow) Prompt(hostname string) error

func (*GitCredentialFlow) Scopes

func (flow *GitCredentialFlow) Scopes() []string

func (*GitCredentialFlow) Setup

func (flow *GitCredentialFlow) Setup(hostname, username, authToken string) error

func (*GitCredentialFlow) ShouldSetup

func (flow *GitCredentialFlow) ShouldSetup() bool

type LoginOptions

type LoginOptions struct {
	IO               *iostreams.IOStreams
	Config           iconfig
	HTTPClient       *http.Client
	GitClient        *git.Client
	Hostname         string
	Interactive      bool
	Web              bool
	Scopes           []string
	Executable       string
	GitProtocol      string
	Prompter         Prompt
	Browser          browser.Browser
	SecureStorage    bool
	SkipSSHKeyPrompt bool
	// contains filtered or unexported fields
}

type MissingScopesError

type MissingScopesError struct {
	MissingScopes []string
}

func (MissingScopesError) Error

func (e MissingScopesError) Error() string

type Prompt added in v2.16.0

type Prompt interface {
	Select(string, string, []string) (int, error)
	Confirm(string, bool) (bool, error)
	InputHostname() (string, error)
	AuthToken() (string, error)
	Input(string, string) (string, error)
	Password(string) (string, error)
}

Jump to

Keyboard shortcuts

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