configs

package
v1.9.10 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package configs sets up the environment. First it sets a number of default envs, then looks in the $HOME/.config/ghorg/conf.yaml to overwrite the defaults. These values will be superseded by any command line flags used

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoGitHubToken error message when token is not found
	ErrNoGitHubToken = errors.New("Could not find a valid github token. GHORG_GITHUB_TOKEN or (--token, -t) flag must be set. Create a personal access token, then set it in your $HOME/.config/ghorg/conf.yaml or use the (--token, -t) flag, see 'GitHub Setup' in README.md")

	// ErrNoGitLabToken error message when token is not found
	ErrNoGitLabToken = errors.New("Could not find a valid gitlab token. GHORG_GITLAB_TOKEN or (--token, -t) flag must be set. Create a token from gitlab then set it in your $HOME/.config/ghorg/conf.yaml or use the (--token, -t) flag, see 'GitLab Setup' in README.md")

	// ErrNoGiteaToken error message when token is not found
	ErrNoGiteaToken = errors.New("Could not find a valid gitea token. GHORG_GITEA_TOKEN or (--token, -t) flag must be set. Create a token from gitea then set it in your $HOME/.config/ghorg/conf.yaml or use the (--token, -t) flag, see 'Gitea Setup' in README.md")

	// ErrNoBitbucketUsername error message when no username found
	ErrNoBitbucketUsername = errors.New("Could not find bitbucket username. GHORG_BITBUCKET_USERNAME or (--bitbucket-username) must be set to clone repos from bitbucket, see 'BitBucket Setup' in README.md")

	// ErrNoBitbucketAppPassword error message when no app password found
	ErrNoBitbucketAppPassword = errors.New("Could not find a valid bitbucket app password. GHORG_BITBUCKET_APP_PASSWORD or (--token, -t) must be set to clone repos from bitbucket, see 'BitBucket Setup' in README.md")

	// ErrIncorrectScmType indicates an unsupported scm type being used
	ErrIncorrectScmType = errors.New("GHORG_SCM_TYPE or --scm must be one of " + strings.Join(scm.SupportedClients(), ", "))

	// ErrIncorrectCloneType indicates an unsupported clone type being used
	ErrIncorrectCloneType = errors.New("GHORG_CLONE_TYPE or --clone-type must be one of org or user")

	// ErrIncorrectProtocolType indicates an unsupported protocol type being used
	ErrIncorrectProtocolType = errors.New("GHORG_CLONE_PROTOCOL or --protocol must be one of https or ssh")
)

Functions

func DefaultConfFile added in v1.7.0

func DefaultConfFile() string

func EnsureTrailingSlashOnFilePath added in v1.7.6

func EnsureTrailingSlashOnFilePath(s string) string

EnsureTrailingSlashOnFilePath takes a filepath and ensures a single / is appened

func EnsureTrailingSlashOnURL added in v1.7.6

func EnsureTrailingSlashOnURL(s string) string

EnsureTrailingSlashOnURL takes a url and ensures a single / is appened

func GetAbsolutePathToCloneTo added in v1.7.0

func GetAbsolutePathToCloneTo() string

func GetOrSetToken

func GetOrSetToken()

GetOrSetToken will set token based on scm

func GetRequiredString

func GetRequiredString(key string) string

GetRequiredString verifies env is set

func GetTokenFromFile added in v1.9.10

func GetTokenFromFile(path string) string

func GhorgConfDir added in v1.8.1

func GhorgConfDir() string

GhorgConfDir returns the ghorg directory path

func GhorgIgnoreDetected

func GhorgIgnoreDetected() bool

GhorgIgnoreDetected returns true if a ghorgignore file exists.

func GhorgIgnoreLocation

func GhorgIgnoreLocation() string

GhorgIgnoreLocation returns the path of users ghorgignore

func GhorgQuiet added in v1.7.12

func GhorgQuiet() bool

func GhorgReCloneDetected added in v1.8.1

func GhorgReCloneDetected() bool

GhorgReCloneDetected returns true if a reclone.yaml file exists.

func GhorgReCloneLocation added in v1.8.1

func GhorgReCloneLocation() string

GhorgReCloneLocation returns the path of users ghorgignore

func HomeDir

func HomeDir() string

HomeDir finds the users home directory

func IsFilePath added in v1.9.10

func IsFilePath(path string) bool

func Load

func Load()

Load triggers the configs to load first, not sure if this is actually needed

func VerifyConfigsSetCorrectly

func VerifyConfigsSetCorrectly() error

VerifyConfigsSetCorrectly makes sure flags are set to appropriate values

func VerifyTokenSet

func VerifyTokenSet() error

VerifyTokenSet checks to make sure env is set for the correct scm provider

func XConfigHomeSet

func XConfigHomeSet() bool

XConfigHomeSet checks for XDG_CONFIG_HOME env set

Types

This section is empty.

Jump to

Keyboard shortcuts

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