config

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLanguage = "go"

Variables

View Source
var (
	ErrUnsupportedLanguage = errors.New("language not supported")
)

Functions

func GetSupportedLanguages

func GetSupportedLanguages() map[string]string

func NormalizeLanguage

func NormalizeLanguage(language string) (string, error)

Types

type Config

type Config struct {
	OpenInEditor bool     `yaml:"openInEditor"`
	Verbose      bool     `yaml:"verbose"`
	Session      Session  `yaml:"session,inline"`
	Username     string   `yaml:"username"`
	Tracks       []string `yaml:"tracks"`
	// contains filtered or unexported fields
}

func (*Config) HasValidSession

func (c *Config) HasValidSession() bool

func (*Config) LanguageName

func (c *Config) LanguageName() string

func (Config) MarshalYAML

func (c Config) MarshalYAML() (any, error)

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(any) error) error

func (*Config) WorkspacePath

func (c *Config) WorkspacePath() string

type ConfigBackup

type ConfigBackup struct {
	Config *Config
}

func NewConfigBackup

func NewConfigBackup(cfg *Config) *ConfigBackup

type ConfigRepository

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

func NewConfigRepository

func NewConfigRepository() (*ConfigRepository, error)

func (*ConfigRepository) Exists

func (r *ConfigRepository) Exists() (bool, error)

func (*ConfigRepository) GetPath

func (r *ConfigRepository) GetPath() string

func (*ConfigRepository) Load

func (r *ConfigRepository) Load() (*Config, error)

func (*ConfigRepository) Restore

func (r *ConfigRepository) Restore(backup *ConfigBackup) error

func (*ConfigRepository) Save

func (r *ConfigRepository) Save(cfg *Config) error

func (*ConfigRepository) SaveWithTemplate

func (r *ConfigRepository) SaveWithTemplate(cfg *Config) error

type ConfigService

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

func New

func New() (*ConfigService, error)

func NewConfigService

func NewConfigService(repo ConfigRepository, validator ConfigValidator) *ConfigService

func (*ConfigService) ClearSession

func (s *ConfigService) ClearSession() error

func (*ConfigService) EditConfig

func (s *ConfigService) EditConfig() error

func (*ConfigService) EnsureConfig

func (s *ConfigService) EnsureConfig() (*Config, error)

func (*ConfigService) GetPath

func (s *ConfigService) GetPath() string

func (*ConfigService) GetWarnings

func (s *ConfigService) GetWarnings() []string

func (*ConfigService) IsSupportedLanguage

func (s *ConfigService) IsSupportedLanguage(language string) bool

func (*ConfigService) SaveUsername

func (s *ConfigService) SaveUsername(username string) error

func (*ConfigService) UpdateSession

func (s *ConfigService) UpdateSession(session Session) error

type ConfigValidator

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

func NewConfigValidator

func NewConfigValidator() *ConfigValidator

func (*ConfigValidator) IsSupportedLanguage

func (v *ConfigValidator) IsSupportedLanguage(lang string) bool

func (*ConfigValidator) Validate

func (v *ConfigValidator) Validate(c *Config) error

func (*ConfigValidator) ValidateWithFallback

func (v *ConfigValidator) ValidateWithFallback(c *Config) error

type Language

type Language string

func NewLanguage

func NewLanguage(lang string) (Language, error)

func (Language) String

func (l Language) String() string

type LanguageResult

type LanguageResult struct {
	Language Language
	Warning  string
}

func NewLanguageWithFallback

func NewLanguageWithFallback(lang string) LanguageResult

type Session

type Session struct {
	SessionToken string `yaml:"sessionToken"`
	CsrfToken    string `yaml:"csrfToken"`
}

func NewSession

func NewSession(sessionToken, csrfToken string) Session

func (Session) Clear

func (s Session) Clear() Session

func (Session) IsValid

func (s Session) IsValid() bool

type Workspace

type Workspace string

func NewWorkspace

func NewWorkspace(path string) (Workspace, error)

func (Workspace) String

func (w Workspace) String() string

Jump to

Keyboard shortcuts

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