ini

package
v1.106.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilePath added in v1.30.3

func FilePath(ctx context.Context, v *viper.Viper) (string, error)

FilePath returns the path for wakatime config file.

func ImportFilePath added in v1.42.1

func ImportFilePath(_ context.Context, v *viper.Viper) (string, error)

ImportFilePath returns the path for import wakatime config file.

func InternalFilePath added in v1.30.3

func InternalFilePath(ctx context.Context, v *viper.Viper) (string, error)

InternalFilePath returns the path for the wakatime internal config file.

func ReadInConfig added in v1.30.3

func ReadInConfig(v *viper.Viper, configFilePath string) error

ReadInConfig reads wakatime config file in memory.

func WakaResourcesDir added in v1.73.0

func WakaResourcesDir(ctx context.Context) (string, error)

WakaResourcesDir returns the ~/.wakatime/ folder.

Types

type WakaHomeType added in v1.73.0

type WakaHomeType int

WakaHomeType is WakaTime home type.

const (

	// DateFormat is the default format for date in config file.
	DateFormat = time.RFC3339

	// WakaHomeTypeUnknown is unknown WakaTime home type.
	WakaHomeTypeUnknown WakaHomeType = iota
	// WakaHomeTypeEnvVar is WakaTime home type from environment variable.
	WakaHomeTypeEnvVar
	// WakaHomeTypeOSDir is WakaTime home type from OS directory.
	WakaHomeTypeOSDir
)

func WakaHomeDir added in v1.30.3

func WakaHomeDir(ctx context.Context) (string, WakaHomeType, error)

WakaHomeDir returns the current user's home directory.

type Writer added in v1.30.3

type Writer interface {
	Write(ctx context.Context, section string, keyValue map[string]string) error
}

Writer defines the methods to write to config file.

type WriterConfig added in v1.30.3

type WriterConfig struct {
	ConfigFilepath string
	File           *ini.File
}

WriterConfig stores the configuration necessary to write to config file.

func NewWriter added in v1.45.1

func NewWriter(
	ctx context.Context,
	v *viper.Viper,
	filepathFn func(ctx context.Context, v *viper.Viper) (string, error),
) (*WriterConfig, error)

NewWriter creates a new writer instance.

func (*WriterConfig) Write added in v1.30.3

func (w *WriterConfig) Write(ctx context.Context, section string, keyValue map[string]string) error

Write persists key(s) and value(s) on disk.

Jump to

Keyboard shortcuts

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