flagutil

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultGitHubTokenPath = "/etc/github/oauth" // Exported for testing purposes

Variables

This section is empty.

Functions

This section is empty.

Types

type GitHubOptions

type GitHubOptions struct {
	Host string

	TokenPath         string
	AllowAnonymous    bool
	AllowDirectAccess bool
	// contains filtered or unexported fields
}

GitHubOptions holds options for interacting with GitHub.

Set AllowAnonymous to be true if you want to allow anonymous github access. Set AllowDirectAccess to be true if you want to suppress warnings on direct github access (without ghproxy).

func (*GitHubOptions) AddFlags

func (o *GitHubOptions) AddFlags(fs *flag.FlagSet)

AddFlags injects GitHub options into the given FlagSet.

func (*GitHubOptions) GitClient

func (o *GitHubOptions) GitClient(secretAgent *secret.Agent, dryRun bool) (client *git.Client, err error)

GitClient returns a Git client.

func (*GitHubOptions) GitHubClient

func (o *GitHubOptions) GitHubClient(secretAgent *secret.Agent, dryRun bool) (client github.Client, err error)

GitHubClient returns a GitHub client.

func (*GitHubOptions) GitHubClientWithAccessToken

func (o *GitHubOptions) GitHubClientWithAccessToken(token string) github.Client

GitHubClientWithAccessToken creates a GitHub client from an access token.

func (*GitHubOptions) GitHubClientWithLogFields

func (o *GitHubOptions) GitHubClientWithLogFields(secretAgent *secret.Agent, dryRun bool, fields logrus.Fields) (client github.Client, err error)

GitHubClientWithLogFields returns a GitHub client with extra logging fields

func (*GitHubOptions) Validate

func (o *GitHubOptions) Validate(bool) error

Validate validates GitHub options. Note that validate updates the GitHubOptions to add default valiues for TokenPath and graphqlEndpoint.

Jump to

Keyboard shortcuts

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