cache

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AppDataDirName is the cache directory name under the platform-specific data root.
	AppDataDirName = "licenser"
)

Variables

This section is empty.

Functions

func DataDir

func DataDir() (string, error)

DataDir returns the directory where licenser stores cached license data. Uses XDG_DATA_HOME/licenser if set, otherwise platform-specific defaults.

func EnsureData

func EnsureData(ctx context.Context) (string, error)

EnsureData checks if cached data exists and is fresh. If not, it fetches license data from GitHub. Returns the cache directory path.

func FetchLicenses

func FetchLicenses(ctx context.Context, dir string) (err error)

FetchLicenses downloads license data from the GitHub choosealicense.com repo.

func IsStale

func IsStale(dir string) bool

IsStale returns true if the cached data is older than 30 days.

func LicenseCount

func LicenseCount(dir string) int

LicenseCount returns the number of .txt files in the cache directory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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