profile

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPreviousNotSet   = errors.New("previous profile not set")
	ErrPreviousNotExist = errors.New("previous profile does not exist")
)
View Source
var (
	ErrExist         = errors.New("profile already exists")
	ErrNotExist      = errors.New("profile does not exist")
	ErrActive        = errors.New("profile already active")
	ErrNameUnchanged = errors.New("name unchanged")
	ConfigDirName    = "profiles"
)
View Source
var ErrNoActive = errors.New("no profile is active")
View Source
var ErrNoneFound = errors.New("no profiles found")
View Source
var ErrUnknownProfile = errors.New("unknown profile")

Functions

func ConfigDir added in v1.2.0

func ConfigDir() string

func ShellCompName added in v1.3.2

func ShellCompName(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)

Types

type ActiveStatus added in v1.2.0

type ActiveStatus struct {
	Global bool
	Local  bool
}

func (ActiveStatus) IsActive added in v1.2.0

func (s ActiveStatus) IsActive() bool

func (ActiveStatus) IsAnyActive added in v1.2.0

func (s ActiveStatus) IsAnyActive() bool

type GetActiveFilter added in v1.3.0

type GetActiveFilter uint8
const (
	GetActiveDynamic GetActiveFilter = iota
	GetActiveGlobal
	GetActiveLocal
)

type Profile

type Profile struct {
	Name string
}

func GetActive added in v1.3.0

func GetActive(filters ...GetActiveFilter) (Profile, error)

func GetPrevious added in v1.3.0

func GetPrevious() (Profile, error)

func List

func List() ([]Profile, error)

func New

func New(name string) Profile

func PromptNew

func PromptNew() (Profile, error)

func Select added in v1.0.1

func Select(message string) (Profile, error)

func (Profile) ActivateGlobally added in v1.2.0

func (p Profile) ActivateGlobally(force bool) error

func (Profile) ActivateLocally added in v1.2.0

func (p Profile) ActivateLocally(force bool) error

func (Profile) ConfigPath added in v1.2.0

func (p Profile) ConfigPath() string

func (Profile) Create

func (p Profile) Create() error

func (Profile) Exists

func (p Profile) Exists() bool

func (Profile) HostsPath

func (p Profile) HostsPath() string

func (Profile) IsActiveGlobally added in v1.2.0

func (p Profile) IsActiveGlobally() bool

func (Profile) IsActiveLocally added in v1.2.0

func (p Profile) IsActiveLocally() bool

func (Profile) Path

func (p Profile) Path() string

func (Profile) Remove added in v1.1.0

func (p Profile) Remove() error

func (Profile) Rename added in v1.0.1

func (p Profile) Rename(to string) error

func (Profile) Status added in v1.2.0

func (p Profile) Status() ActiveStatus

func (Profile) WritePrevious added in v1.3.0

func (p Profile) WritePrevious() error

Jump to

Keyboard shortcuts

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