params

package
v1.104.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Once sync.Once // nolint:gochecknoglobals

Once prevents reading from stdin twice.

Functions

func LoadAPIKey added in v1.88.0

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

LoadAPIKey loads a valid default WakaTime API Key or returns an error.

Types

type API

type API struct {
	BackoffAt        time.Time
	BackoffRetries   int
	DisableSSLVerify bool
	Hostname         string
	Key              string
	KeyPatterns      []apikey.MapPattern
	Plugin           string
	ProxyURL         string
	SSLCertFilepath  string
	Timeout          time.Duration
	URL              string
}

API contains api related parameters.

func LoadAPIParams added in v1.35.4

func LoadAPIParams(ctx context.Context, v *viper.Viper) (API, error)

LoadAPIParams loads API params from viper.Viper instance. Returns ErrAuth if failed to retrieve api key.

func (API) String

func (p API) String() string

String implements fmt.Stringer interface.

type ExtraHeartbeat added in v1.40.0

type ExtraHeartbeat struct {
	BranchAlternate   string             `json:"alternate_branch"`
	Category          heartbeat.Category `json:"category"`
	CursorPosition    any                `json:"cursorpos"`
	Entity            string             `json:"entity"`
	EntityType        string             `json:"entity_type"`
	Type              string             `json:"type"`
	IsUnsavedEntity   any                `json:"is_unsaved_entity"`
	IsWrite           any                `json:"is_write"`
	Language          *string            `json:"language"`
	LanguageAlternate string             `json:"alternate_language"`
	LineAdditions     any                `json:"line_additions"`
	LineDeletions     any                `json:"line_deletions"`
	LineNumber        any                `json:"lineno"`
	Lines             any                `json:"lines"`
	Project           string             `json:"project"`
	ProjectAlternate  string             `json:"alternate_project"`
	Time              any                `json:"time"`
	Timestamp         any                `json:"timestamp"`
}

ExtraHeartbeat contains extra heartbeat.

type FilterParams added in v1.30.5

type FilterParams struct {
	Exclude                    []regex.Regex
	ExcludeUnknownProject      bool
	Include                    []regex.Regex
	IncludeOnlyWithProjectFile bool
}

FilterParams contains heartbeat filtering related command parameters.

func (FilterParams) String added in v1.30.5

func (p FilterParams) String() string

type Heartbeat added in v1.30.5

type Heartbeat struct {
	Category          heartbeat.Category
	CursorPosition    *int
	Entity            string
	EntityType        heartbeat.EntityType
	ExtraHeartbeats   []heartbeat.Heartbeat
	GuessLanguage     bool
	IsUnsavedEntity   bool
	IsWrite           *bool
	Language          *string
	LanguageAlternate string
	LineAdditions     *int
	LineDeletions     *int
	LineNumber        *int
	LinesInFile       *int
	LocalFile         string
	Time              float64
	Filter            FilterParams
	Project           ProjectParams
	Sanitize          SanitizeParams
}

Heartbeat contains heartbeat command parameters.

func LoadHeartbeatParams added in v1.35.4

func LoadHeartbeatParams(ctx context.Context, v *viper.Viper) (Heartbeat, error)

LoadHeartbeatParams loads heartbeats params from viper.Viper instance.

func (Heartbeat) String added in v1.30.5

func (p Heartbeat) String() string

type Offline added in v1.30.5

type Offline struct {
	Disabled   bool
	LastSentAt time.Time
	PrintMax   int
	RateLimit  time.Duration
	SyncMax    int
}

Offline contains offline related parameters.

func LoadOfflineParams added in v1.35.4

func LoadOfflineParams(ctx context.Context, v *viper.Viper) Offline

LoadOfflineParams loads offline params from viper.Viper instance.

func (Offline) String added in v1.30.5

func (p Offline) String() string

String implements fmt.Stringer interface.

type Params

type Params struct {
	API       API
	Heartbeat Heartbeat
	Offline   Offline
	StatusBar StatusBar
}

Params contains params.

func (Params) String added in v1.30.5

func (p Params) String() string

String implements fmt.Stringer interface.

type ProjectParams added in v1.30.5

type ProjectParams struct {
	Alternate            string
	BranchAlternate      string
	MapPatterns          []project.MapPattern
	Override             string
	ProjectFromGitRemote bool
	SubmodulesDisabled   []regex.Regex
	SubmoduleMapPatterns []project.MapPattern
}

ProjectParams params for project name sanitization.

func (ProjectParams) String added in v1.30.5

func (p ProjectParams) String() string

type SanitizeParams added in v1.30.5

type SanitizeParams struct {
	HideBranchNames     []regex.Regex
	HideFileNames       []regex.Regex
	HideProjectFolder   bool
	HideProjectNames    []regex.Regex
	ProjectPathOverride string
}

SanitizeParams params for heartbeat sanitization.

func (SanitizeParams) String added in v1.30.5

func (p SanitizeParams) String() string

type StatusBar added in v1.30.5

type StatusBar struct {
	HideCategories bool
	Output         output.Output
}

StatusBar contains status bar related parameters.

func LoadStatusBarParams added in v1.64.1

func LoadStatusBarParams(v *viper.Viper) (StatusBar, error)

LoadStatusBarParams loads status bar params from viper.Viper instance.

func (StatusBar) String added in v1.30.5

func (p StatusBar) String() string

String implements fmt.Stringer interface.

Jump to

Keyboard shortcuts

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