profiles

package
v1.135.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package profiles stores named credential profiles in ~/.config/bitbottle/profiles.yml. Each profile is a set of Bitbucket credentials (hostname, token, user, etc.) that can be switched as a unit, similar to how kubectl manages contexts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NamedProfile

type NamedProfile struct {
	Name string
	Profile
}

NamedProfile is a Profile annotated with its store key, used for listing.

type Profile

type Profile struct {
	Hostname      string `yaml:"hostname"`
	Token         string `yaml:"token"`
	User          string `yaml:"user,omitempty"`
	AuthUser      string `yaml:"auth_user,omitempty"`
	SkipTLSVerify bool   `yaml:"skip_tls_verify,omitempty"`
	BackendType   string `yaml:"backend_type,omitempty"` // "server" | "cloud" | "" (auto)
	GitProtocol   string `yaml:"git_protocol,omitempty"` // "https" | "ssh"
}

Profile is a named set of Bitbucket credentials.

type Store

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

Store is a thread-safe handle to profiles.yml.

func New

func New(dir string) *Store

New returns a new Store rooted at dir.

func (*Store) All

func (s *Store) All() []NamedProfile

All returns all profiles as a sorted slice of NamedProfile.

func (*Store) Delete

func (s *Store) Delete(name string) bool

Delete removes the profile with the given name. Returns true if it existed.

func (*Store) Get

func (s *Store) Get(name string) (Profile, bool)

Get returns the Profile for name, if any.

func (*Store) Load

func (s *Store) Load() error

Load reads profiles.yml. A missing file is treated as an empty store.

func (*Store) Save

func (s *Store) Save() error

Save writes profiles.yml atomically via a temp file + rename.

func (*Store) Set

func (s *Store) Set(name string, p Profile)

Set stores p under name, overwriting any existing profile with that name.

Jump to

Keyboard shortcuts

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