work

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChdirFlag

func ChdirFlag(cmd *cobra.Command, opts *ChdirOptions, value string) error

Types

type ChdirOptions

type ChdirOptions struct {
	// contains filtered or unexported fields
}

func NewChdirOptions

func NewChdirOptions(d string) ChdirOptions

func (ChdirOptions) Chdir

func (o ChdirOptions) Chdir(ctx context.Context) error

func (ChdirOptions) Cwd

func (o ChdirOptions) Cwd(ctx context.Context) (Directory, error)

type Directory

type Directory string

A Directory defines a path to a valid, existing directory on the local filesystem

func Cwd

func Cwd() (work Directory, err error)

Cwd returns a Directory pointing to the current working directory

func Git

func Git(ctx context.Context) (work Directory, err error)

Git returns a Directory pointing to the git repository closest to the current working directory

func Load

func Load(ctx context.Context) (work Directory, err error)

Load returns a Directory pointing to the first directory able to be resolved without error.

Load will attempt directories in the following order:

func (Directory) Fs added in v0.1.7

func (c Directory) Fs(options ...Option) afero.Fs

Fs returns an afero.Fs rooted at c

func (Directory) Path

func (c Directory) Path() string

Path returns the Directory path as a string

type Option added in v0.1.7

type Option func(*Options)

func WithRoot added in v0.1.7

func WithRoot(fs afero.Fs) Option

WithRoot returns an option to use fs as the root for filesystem operations

type Options added in v0.1.7

type Options struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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