progress

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package progress persists the player's journey to a versioned JSON file.

Index

Constants

View Source
const Version = 2

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() string

DefaultPath is ~/.nvim-quest/progress.json.

func Save

func Save(path string, p *Progress) error

Types

type Progress

type Progress struct {
	Version    int            `json:"version"`
	XP         int            `json:"xp"`
	Level      int            `json:"level"`
	Stars      map[string]int `json:"stars"`
	Completed  []string       `json:"completed"`
	Badges     []string       `json:"badges"`
	LastLesson string         `json:"lastLesson"`
	// Theme is the selected UI color theme (empty = default). It is a display
	// setting rather than progress, but it rides along in the same file. Added
	// after Version 2; omitempty keeps it out of older saves, and a missing
	// value unmarshals to "" so v2 files load without a version bump.
	Theme string `json:"theme,omitempty"`
}

func Load

func Load(path string) *Progress

Load never fails: missing, corrupt, or old-version files yield a fresh Progress (old files are kept as <path>.v1.bak).

func New

func New() *Progress

func (*Progress) AddBadge

func (p *Progress) AddBadge(name string)

func (*Progress) HasBadge

func (p *Progress) HasBadge(name string) bool

func (*Progress) IsCompleted

func (p *Progress) IsCompleted(id string) bool

func (*Progress) MarkCompleted

func (p *Progress) MarkCompleted(id string)

Jump to

Keyboard shortcuts

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