{"modulePath":"github.com/181192/ops-cli","version":"v0.1.20","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package git\n\n## Functions\n\n```go\nfunc IsGitURL(rawURL string) bool\n```\nIsGitURL returns true if the argument matches the git url format\n\n```go\nfunc RepoName(repoURL string) (string, error)\n```\nRepoName returns the name of the repository given its URL\n\n```go\nfunc ValidateURL(url string) error\n```\nValidateURL validates the provided Git URL.\n\n## Types\n\n```go\ntype Client struct {\n\t// contains filtered or unexported fields\n}\n```\nClient can perform git operations on the given directory\n\n```go\nfunc NewGitClient(params ClientParams) *Client\n```\nNewGitClient returns a client that can perform git operations\n\n```go\nfunc NewGitClientFromExecutor(executor executor.Executor) *Client\n```\nNewGitClientFromExecutor returns a client that can have an executor injected. Useful for testing\n\n```go\nfunc (git Client) Add(files ...string) error\n```\nAdd performs can perform a \\`git add\\` operation on the given file paths\n\n```go\nfunc (git *Client) CloneRepoInPath(clonePath string, options CloneOptions) error\n```\nCloneRepoInPath behaves like CloneRepoInTmpDir but clones the repository in a specific directory which creates if needed\n\n```go\nfunc (git *Client) CloneRepoInTmpDir(tmpDirPrefix string, options CloneOptions) (string, error)\n```\nCloneRepoInTmpDir clones a repo specified in the gitURL in a temporary directory and checks out the specified branch\n\n```go\nfunc (git Client) Commit(message, user, email string) error\n```\nCommit makes a commit if there are staged changes\n\n```go\nfunc (git Client) DeleteLocalRepo() error\n```\nDeleteLocalRepo deletes the local copy of a repository, including the directory\n\n```go\nfunc (git Client) Push() error\n```\nPush pushes the changes to the origin remote\n\n```go\ntype ClientParams struct {\n\tPrivateSSHKeyPath string\n}\n```\nClientParams groups the arguments to provide to create a new Git client.\n\n```go\ntype CloneOptions struct {\n\tURL       string\n\tBranch    string\n\tBootstrap bool // create the branch if the repository is empty\n}\n```\nCloneOptions are the options for cloning a Git repository\n\n```go\ntype Options struct {\n\tURL               string\n\tBranch            string\n\tUser              string\n\tEmail             string\n\tPrivateSSHKeyPath string\n}\n```\nOptions holds options to interact with a Git repository.\n\n```go\nfunc (o Options) Validate() error\n```\nValidate validates this Options object.\n\n```go\nfunc (o Options) ValidateEmail() error\n```\nValidateEmail validates the email field of this Options object, return an error should the current value not be valid.\n\n```go\nfunc (o Options) ValidatePrivateSSHKeyPath() error\n```\nValidatePrivateSSHKeyPath validates the path to the (optional) private SSH key used to interact with the Git repository configured in this object.\n\n```go\nfunc (o Options) ValidateURL() error\n```\nValidateURL validates the URL field of this Options object, returning an error should the current value not be valid.\n\n```go\ntype TmpCloner interface {\n\tCloneRepoInTmpDir(cloneDirPrefix string, options CloneOptions) (string, error)\n}\n```\nTmpCloner can clone git repositories in temporary directories\n\n","path":"github.com/181192/ops-cli/pkg/git","name":"git","synopsis":"","isRedistributable":true}
