cmdstate

package
v0.0.0-...-13ce33a Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDir = "~/.atlas"

DefaultDir is the directory where CLI state is stored.

Variables

This section is empty.

Functions

func TestingHome

func TestingHome(t *testing.T) string

TestingHome is a helper function for testing that sets the HOME directory to a temporary directory.

Types

type File

type File[T any] struct {
	// Dir where the file is stored. If empty, DefaultDir is used.
	Dir string
	// Name of the file. Suffixed with .json.
	Name string
}

File is a state file for the given type.

func (File[T]) Path

func (f File[T]) Path() (string, error)

Path returns the path to the file.

func (File[T]) Read

func (f File[T]) Read() (v T, err error)

Read reads the value from the file system.

func (File[T]) Write

func (f File[T]) Write(t T) error

Write writes the value to the file system.

Jump to

Keyboard shortcuts

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