executor

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2024 License: MIT Imports: 11 Imported by: 4

Documentation

Overview

package executor provides a git-describe executor for gh-git-describe.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor interface {
	// RunRepoClone clones the specified GitHub repository.
	RunRepoClone(params *RepoCloneParams) (string, error)

	// RunRepoCloneContext clones the specified GitHub repository with the specified context.
	RunRepoCloneContext(ctx context.Context, params *RepoCloneParams) (string, error)

	// RunGitDescribe runs the 'git describe' command for the specified GitHub repository.
	RunGitDescribe(params *RepoCloneParams, args ...string) (string, error)

	// RunGitDescribe runs the 'git describe' command for the specified GitHub repository with the specified context.
	RunGitDescribeContext(ctx context.Context, params *RepoCloneParams, args ...string) (string, error)
}

Executor is an interface for the command executors.

func New

func New(params *Params) (Executor, error)

New creates a new Executor instance.

type Params

type Params struct {
	// GitExecutor is an instance of gitexec.GitExecutor
	GitExecutor gitexec.GitExecutor

	// Logger is the slog.Logger instance.
	Logger *slog.Logger

	// CacheDirPath is the directory path to store the cache.
	CacheDirPath string

	// CacheTTL is the cache retention duration for the cloned repository.
	CacheTTL time.Duration
}

Params represents the parameters for the New function.

func NewParams

func NewParams() *Params

NewParams creates a new Params instance.

func (*Params) WithLogger

func (p *Params) WithLogger(logger *slog.Logger) *Params

WithLogger sets the logger instance.

type RepoCloneParams

type RepoCloneParams struct {
	// RepoID is the repository ID (OWNER/NAME) of the repository to clone.
	// If not specified, the current repository is used.
	RepoID string

	// CacheTTL is the cache TTL duration.
	CacheTTL time.Duration
}

RepoCloneParams represents the parameters for the RunRepoClone function.

Jump to

Keyboard shortcuts

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