storage

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prefs

type Prefs struct {
	ColorTheme    int  `json:"color_theme"`
	SplashSeen020 bool `json:"splash_seen_020"`
	ShellEnabled  bool `json:"shell_enabled"`
	// ShowUsername toggles the Accounts secondary column between email
	// (zero value / default) and the GitHub username.
	ShowUsername       bool   `json:"show_username"`
	ShellAlias         string `json:"shell_alias"`
	ShellAliasDisabled bool   `json:"shell_alias_disabled"` // zero value = enabled (default on)
	ArcadeHiScore      int    `json:"arcade_hi_score,omitempty"`
	ArcadeMode         bool   `json:"arcade_mode,omitempty"`
	// AutoPinDisabled turns off auto-pinning the active account to a repo once
	// it's been used there AutoPinThreshold times. Zero value = enabled (default on).
	AutoPinDisabled bool `json:"auto_pin_disabled"`
}

type Profile

type Profile struct {
	Nickname string `json:"nickname"  yaml:"nickname"`
	UserName string `json:"user_name"  yaml:"user_name"`
	Email    string `json:"email"      yaml:"email"`
	SignKey  string `json:"sign_key,omitempty"  yaml:"sign_key,omitempty"`
	SSHKey   string `json:"ssh_key,omitempty"   yaml:"ssh_key,omitempty"`
	GHUser   string `json:"gh_user,omitempty"   yaml:"gh_user,omitempty"`
	TokenRef string `json:"token_ref,omitempty" yaml:"token_ref,omitempty"`
	Active   bool   `json:"active"     yaml:"active"`
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func New

func New() (*Store, error)

func NewAt

func NewAt(path string) *Store

NewAt returns a Store rooted at the given directory. Used by tests.

func (*Store) Add

func (s *Store) Add(nickname, userName, email, signKey, sshKey, ghUser string) error

func (*Store) BakCreated

func (s *Store) BakCreated() bool

BakCreated reports whether the .v1.bak backup file was successfully created during migration. False means profiles.json may still be present.

func (*Store) ConfigDir

func (s *Store) ConfigDir() string

func (*Store) Get

func (s *Store) Get(nickname string) (*Profile, error)

func (*Store) GetActive

func (s *Store) GetActive() (*Profile, error)

func (*Store) GetByEmail added in v0.3.0

func (s *Store) GetByEmail(email string) *Profile

GetByEmail returns the profile owning an email address, or nil if none does. Matching is case-insensitive: git config casing need not match what was saved. Used to recognise an identity gitswitch did not write (a hand-configured repo).

func (*Store) ImportCurrent

func (s *Store) ImportCurrent() error

func (*Store) Load

func (s *Store) Load() ([]Profile, error)

func (*Store) LoadPrefs

func (s *Store) LoadPrefs() (Prefs, error)

func (*Store) Remove

func (s *Store) Remove(nickname string) error

func (*Store) Save

func (s *Store) Save(profiles []Profile) error

func (*Store) SavePrefs

func (s *Store) SavePrefs(p Prefs) error

func (*Store) SetActive

func (s *Store) SetActive(nickname string) error

func (*Store) Update

func (s *Store) Update(nickname string, updated Profile) error

func (*Store) WasMigrated

func (s *Store) WasMigrated() bool

WasMigrated reports whether Load() performed a first-run migration from profiles.json to config.yaml during this session.

Jump to

Keyboard shortcuts

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