config

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultProfile = "default"

Variables

This section is empty.

Functions

func CheckFileMode

func CheckFileMode(path string) error

func Save

func Save(path string, cfg Config) error

func Update

func Update(ctx context.Context, path string, update func(*Config) error) error

func ValidateProfileName

func ValidateProfileName(name string) error

Types

type Config

type Config struct {
	APIID          int64              `toml:"api_id,omitempty"`
	DefaultLimit   int                `toml:"default_limit,omitempty"`
	DefaultProfile string             `toml:"default_profile,omitempty"`
	Profiles       map[string]Profile `toml:"profiles,omitempty"`
}

func Load

func Load(path string) (Config, error)

func Parse

func Parse(b []byte) (Config, error)

func (*Config) EnsureProfile

func (c *Config) EnsureProfile(name string) (Profile, error)

func (Config) ResolveProfile

func (c Config) ResolveProfile(name string) (string, Profile, error)

type Paths

type Paths struct {
	Config string
	Data   string
}

func DefaultPaths

func DefaultPaths() (Paths, error)

type Profile

type Profile struct {
	APIID int64  `toml:"api_id,omitempty"`
	Phone string `toml:"phone,omitempty"`
}

Jump to

Keyboard shortcuts

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