orgctx

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package orgctx persists the user's "active org" between CLI invocations. Cloud-aware commands (e.g. `bw ledger init --cloud`) read this instead of taking an --org-id flag on every call.

Index

Constants

View Source
const Hint = "No active org. Run `bitwave org use` to pick one, or `bitwave org create` to make a new one."

Hint is the standard remediation message shown when ErrNoActiveOrg is hit.

Variables

View Source
var ErrNoActiveOrg = errors.New("no active org")

ErrNoActiveOrg signals that no org has been selected. Callers should print the user-facing hint via Hint() and exit non-zero.

Functions

func Clear

func Clear() error

Clear removes the active-org pointer.

func Save

func Save(a *Active) error

Save writes the active org to ~/.bitwave/config.json.

Types

type Active

type Active struct {
	OrgID   string `json:"orgId"`
	OrgName string `json:"orgName,omitempty"`
}

Active is the on-disk shape persisted to ~/.bitwave/config.json.

func Load

func Load() (*Active, error)

Load reads ~/.bitwave/config.json. Returns nil, ErrNoActiveOrg when no active org is set.

Jump to

Keyboard shortcuts

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