appctx

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindGitRoot

func FindGitRoot(ctx context.Context, rt *toolkit.Runtime, start string) string

FindGitRoot findGitRoot attempts to use the git CLI to determine the repository top-level directory starting from 'start'. If that fails (git not available, not a git worktree, or command error), it falls back to the original upward filesystem search for a .git entry.

Types

type AppPaths

type AppPaths struct {
	Appname string

	// Root is the path to the root of the context.
	Root string

	// configRoot is the base directory for user configuration files.
	ConfigRoot string

	// stateRoot holds transient state files for the context.
	StateRoot string

	// dataRoot is for programmatically managed data shipped with the program.
	DataRoot string

	// cacheRoot is for cache artifacts.
	CacheRoot string

	// localConfigRoot is the repo-local override location
	LocalConfigRoot string
}

AppPaths holds paths and configuration roots for a repository-backed app context. Root is the repository root. Other roots default to platform user-scoped locations when not provided.

func NewAppPaths

func NewAppPaths(rt *toolkit.Runtime, root, appname string) (*AppPaths, error)

NewAppPaths constructs app paths and fills missing roots using platform defaults derived from the provided context.

Behavior:

  • If an option sets a value it is used as-is.
  • If Root is not set it is inferred from Runtime.Getwd().
  • ConfigRoot, DataRoot, StateRoot, and CacheRoot use the corresponding user-scoped platform paths and are joined with DefaultAppName.

func NewGitAppPaths

func NewGitAppPaths(ctx context.Context, rt *toolkit.Runtime, appname string) (*AppPaths, error)

Jump to

Keyboard shortcuts

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