Documentation
¶
Index ¶
- func ConvertToSSH(httpsURL string) (string, error)
- func GetSSHKeyPath() string
- func IsHTTPSURL(url string) bool
- func IsSSHURL(url string) bool
- func SetSSHKeyPath(cmd *cobra.Command)
- func ValidateSSHKey(keyPath string) error
- type Client
- func (c *Client) Add(ctx context.Context, repoPath string, paths ...string) error
- func (c *Client) Checkout(ctx context.Context, repoPath, ref string) error
- func (c *Client) Clone(ctx context.Context, repoURL, destPath string) error
- func (c *Client) Commit(ctx context.Context, repoPath, message string) error
- func (c *Client) Fetch(ctx context.Context, repoPath string) error
- func (c *Client) GetCurrentBranch(ctx context.Context, repoPath string) (string, error)
- func (c *Client) GetRemoteURL(ctx context.Context, repoPath string) (string, error)
- func (c *Client) LsRemote(ctx context.Context, repoURL, ref string) (string, error)
- func (c *Client) Pull(ctx context.Context, repoPath string) error
- func (c *Client) Push(ctx context.Context, repoPath string) error
- func (c *Client) RevParse(ctx context.Context, repoPath, ref string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToSSH ¶
ConvertToSSH converts HTTPS git URLs to SSH format Example: https://github.com/owner/repo.git → git@github.com:owner/repo.git
func SetSSHKeyPath ¶
SetSSHKeyPath sets the global SSH key path from either the flag or environment variable This should be called once at startup from the root command
func ValidateSSHKey ¶
ValidateSSHKey validates SSH key file exists, readable, and has proper permissions If the keyPath looks like actual key content (starts with "-----BEGIN"), it's considered valid
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides high-level git operations with SSH key support
func NewClient ¶
func NewClient() *Client
NewClient creates a new git client using the global SSH key path
func (*Client) GetCurrentBranch ¶
GetCurrentBranch returns the current branch name
func (*Client) GetRemoteURL ¶
GetRemoteURL returns the remote URL for the repository (typically 'origin')
func (*Client) LsRemote ¶
LsRemote queries a remote repository for a specific ref Returns the commit hash for the ref