config

package
v0.0.0-...-c6ae6cd Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadCobraConfig

func ReadCobraConfig(cmd *cobra.Command, args []string)

func ReadConfig

func ReadConfig()

Types

type Config

type Config struct {
	Chess      *ConfigChess      `yaml:"chess"`
	Paths      *ConfigPaths      `yaml:"paths"`
	Power      *ConfigPower      `yaml:"power"`
	Weather    *ConfigWeather    `yaml:"weather"`
	Mail       *ConfigMail       `yaml:"mail"`
	Prometheus *ConfigPrometheus `yaml:"prometheus"`
	Crypto     *ConfigCrypto     `yaml:"crypto"`
	ExternalIP *ConfigExternalIP `yaml:"externalIp"`
	Fan        *ConfigFan        `yaml:"fan"`
	Forex      *ConfigForex      `yaml:"forex"`
	IntelGPU   *ConfigIntelGPU   `yaml:"intelGpu"`
	Itau       *ConfigItau       `yaml:"itau"`
	Khal       *ConfigKhal       `yaml:"khal"`
	NordVPN    *ConfigNordVPN    `yaml:"nordvpn"`
	Nubank     *ConfigNubank     `yaml:"nubank"`
	OpsGenie   *ConfigOpsGenie   `yaml:"opsgenie"`
	Todoist    *ConfigTodoist    `yaml:"todoist"`
	Editor     *ConfigEditor     `yaml:"editor"`
	SSH        *ConfigSSH        `yaml:"ssh"`
	BW         *ConfigBW         `yaml:"bw"`
}
var SwayItConfig *Config

func NewConfig

func NewConfig() *Config

func (*Config) Save

func (c *Config) Save() error

func (*Config) ToYAML

func (c *Config) ToYAML() (string, error)

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigBW

type ConfigBW struct {
	Enabled           bool   `yaml:"enabled"`
	SuspendOnBattery  bool   `yaml:"suspendOnBattery"`
	Interval          int64  `yaml:"interval" default:"1"`
	IntervalOnBattery int64  `yaml:"intervalOnBattery" default:"5"`
	Command           string `yaml:"command" default:"bw"`
	MaxAge            int64  `yaml:"maxAge" default:"900"`
	SessionToken      string `yaml:"sessionToken"`
}

type ConfigChess

type ConfigChess struct {
	Enabled           bool   `yaml:"enabled"`
	SuspendOnBattery  bool   `yaml:"suspendOnBattery"`
	Interval          int64  `yaml:"interval" default:"60"`
	IntervalOnBattery int64  `yaml:"intervalOnBattery" default:"300"`
	URL               string `yaml:"url" default:"https://api.chess.com/pub"`
	Username          string `yaml:"username"`
}

func (*ConfigChess) UnmarshalYAML

func (c *ConfigChess) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigCrypto

type ConfigCrypto struct {
	Enabled           bool   `yaml:"enabled"`
	SuspendOnBattery  bool   `yaml:"suspendOnBattery"`
	Interval          int64  `yaml:"interval" default:"900"`
	IntervalOnBattery int64  `yaml:"intervalOnBattery" default:"3600"`
	CMCApiKey         string `yaml:"apiKey"`
	BaseCurrency      string `yaml:"baseCurrency" default:"USD"`
	Coins             []struct {
		Symbol      string `yaml:"symbol"`
		Icon        string `yaml:"icon"`
		TooltipOnly bool   `yaml:"tooltipOnly"`
	} `yaml:"coins"`
}

func (*ConfigCrypto) UnmarshalYAML

func (c *ConfigCrypto) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigEditor

type ConfigEditor struct {
	Terminal string   `yaml:"terminal" default:"kitty"`
	Command  string   `yaml:"command" default:"vim"`
	Args     []string `yaml:"args"`
}

func (*ConfigEditor) UnmarshalYAML

func (c *ConfigEditor) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigExternalIP

type ConfigExternalIP struct {
	Enabled           bool  `yaml:"enabled"`
	SuspendOnBattery  bool  `yaml:"suspendOnBattery"`
	Interval          int64 `yaml:"interval" default:"60"`
	IntervalOnBattery int64 `yaml:"intervalOnBattery" default:"300"`
}

func (*ConfigExternalIP) UnmarshalYAML

func (c *ConfigExternalIP) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigFan

type ConfigFan struct {
	Enabled           bool  `yaml:"enabled"`
	SuspendOnBattery  bool  `yaml:"suspendOnBattery"`
	Interval          int64 `yaml:"interval" default:"1"`
	IntervalOnBattery int64 `yaml:"intervalOnBattery" default:"5"`
}

func (*ConfigFan) UnmarshalYAML

func (c *ConfigFan) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigForex

type ConfigForex struct {
	Enabled                bool   `yaml:"enabled"`
	SuspendOnBattery       bool   `yaml:"suspendOnBattery"`
	Interval               int64  `yaml:"interval" default:"3600"`
	IntervalOnBattery      int64  `yaml:"intervalOnBattery" default:"3600"`
	OpenExchangeRatesAppID string `yaml:"apiKey"`
	BaseCurrency           string `yaml:"baseCurrency" default:"USD"`
	BaseSymbol             string `yaml:"baseSymbol" default:"$"`
	Coins                  []struct {
		Symbol      string `yaml:"symbol"`
		Icon        string `yaml:"icon"`
		TooltipOnly bool   `yaml:"tooltipOnly"`
	} `yaml:"coins"`
}

func (*ConfigForex) UnmarshalYAML

func (c *ConfigForex) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigIntelGPU

type ConfigIntelGPU struct {
	Enabled           bool   `yaml:"enabled"`
	SuspendOnBattery  bool   `yaml:"suspendOnBattery"`
	Interval          int64  `yaml:"interval" default:"5"`
	IntervalOnBattery int64  `yaml:"intervalOnBattery" default:"30"`
	Command           string `yaml:"command" default:"/usr/bin/intel_gpu_top"`
	SudoCommand       string `yaml:"sudoCommand" default:"/usr/bin/sudo"`
}

func (*ConfigIntelGPU) UnmarshalYAML

func (c *ConfigIntelGPU) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigItau

type ConfigItau struct {
	Enabled           bool  `yaml:"enabled"`
	SuspendOnBattery  bool  `yaml:"suspendOnBattery"`
	Interval          int64 `yaml:"interval" default:"900"`
	IntervalOnBattery int64 `yaml:"intervalOnBattery" default:"3600"`
}

func (*ConfigItau) UnmarshalYAML

func (c *ConfigItau) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigKhal

type ConfigKhal struct {
	Enabled           bool     `yaml:"enabled"`
	SuspendOnBattery  bool     `yaml:"suspendOnBattery"`
	Interval          int64    `yaml:"interval" default:"10"`
	IntervalOnBattery int64    `yaml:"intervalOnBattery" default:"60"`
	DaysAhead         int      `yaml:"daysAhead" default:"10"`
	IgnoredEvents     []string `yaml:"ignoredEvents"`
	StripClockwise    bool     `yaml:"stripClockwise" default:"true"`
}

func (*ConfigKhal) UnmarshalYAML

func (c *ConfigKhal) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigMail

type ConfigMail struct {
	Enabled           bool              `yaml:"enabled"`
	SuspendOnBattery  bool              `yaml:"suspendOnBattery"`
	Interval          int64             `yaml:"interval" default:"5"`
	IntervalOnBattery int64             `yaml:"intervalOnBattery" default:"60"`
	MuPath            string            `yaml:"muPath" default:"/usr/bin/mu"`
	MainQuery         string            `yaml:"mainQuery" default:"maildir:/.*.INBOX/ AND flag:unread AND NOT flag:trashed"`
	Queries           map[string]string `yaml:"queries"`
}

func (*ConfigMail) UnmarshalYAML

func (c *ConfigMail) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigNordVPN

type ConfigNordVPN struct {
	Enabled           bool   `yaml:"enabled"`
	SuspendOnBattery  bool   `yaml:"suspendOnBattery"`
	Interval          int64  `yaml:"interval" default:"1"`
	IntervalOnBattery int64  `yaml:"intervalOnBattery" default:"5"`
	Command           string `yaml:"command" default:"nordvpn"`
}

func (*ConfigNordVPN) UnmarshalYAML

func (c *ConfigNordVPN) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigNubank

type ConfigNubank struct {
	Enabled           bool  `yaml:"enabled"`
	SuspendOnBattery  bool  `yaml:"suspendOnBattery"`
	Interval          int64 `yaml:"interval" default:"900"`
	IntervalOnBattery int64 `yaml:"intervalOnBattery" default:"3600"`
}

func (*ConfigNubank) UnmarshalYAML

func (c *ConfigNubank) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigOpsGenie

type ConfigOpsGenie struct {
	Enabled           bool   `yaml:"enabled"`
	SuspendOnBattery  bool   `yaml:"suspendOnBattery"`
	Interval          int64  `yaml:"interval" default:"300"`
	IntervalOnBattery int64  `yaml:"intervalOnBattery" default:"900"`
	Email             string `yaml:"email"`
	Profiles          []struct {
		Name      string   `yaml:"name"`
		Token     string   `yaml:"token"`
		Schedules []string `yaml:"schedules"`
	} `yaml:"profiles"`
}

func (*ConfigOpsGenie) UnmarshalYAML

func (c *ConfigOpsGenie) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigPaths

type ConfigPaths struct {
	Cache    string `yaml:"cache"`
	LastRun  string `yaml:"lastRun"`
	Tmp      string `yaml:"tmp"`
	Output   string `yaml:"output"`
	Data     string `yaml:"data"`
	Flags    string `yaml:"flags"`
	Notes    string `yaml:"notes"`
	Snippets string `yaml:"snippets"`
}

func (*ConfigPaths) UnmarshalYAML

func (c *ConfigPaths) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigPower

type ConfigPower struct {
	Enabled           bool   `yaml:"enabled"`
	SuspendOnBattery  bool   `yaml:"suspendOnBattery"`
	Interval          int64  `yaml:"interval" default:"1"`
	IntervalOnBattery int64  `yaml:"intervalOnBattery" default:"5"`
	Battery           string `yaml:"battery" default:"BAT0"`
}

func (*ConfigPower) UnmarshalYAML

func (c *ConfigPower) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigPrometheus

type ConfigPrometheus struct {
	Enabled           bool   `yaml:"enabled"`
	SuspendOnBattery  bool   `yaml:"suspendOnBattery"`
	Interval          int64  `yaml:"interval" default:"60"`
	IntervalOnBattery int64  `yaml:"intervalOnBattery" default:"300"`
	URL               string `yaml:"url"`
	GrafanaURL        string `yaml:"grafanaUrl"`
	Username          string `yaml:"username"`
	Password          string `yaml:"password"`
	Query             string `yaml:"query" default:"instance_job_severity:probe_success:mean5m"`
}

func (*ConfigPrometheus) UnmarshalYAML

func (c *ConfigPrometheus) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigSSH

type ConfigSSH struct {
	Enabled           bool     `yaml:"enabled"`
	SuspendOnBattery  bool     `yaml:"suspendOnBattery"`
	Interval          int64    `yaml:"interval" default:"1"`
	IntervalOnBattery int64    `yaml:"intervalOnBattery" default:"5"`
	Terminal          string   `yaml:"terminal" default:"kitty"`
	TerminalArgs      []string `yaml:"terminalArgs"`
	Command           string   `yaml:"command" default:"ssh"`
	DigitalOcean      struct {
		Contexts []struct {
			Name  string `yaml:"name"`
			Token string `yaml:"token"`
		} `yaml:"contexts"`
	} `yaml:"digitalOcean"`
}

func (*ConfigSSH) UnmarshalYAML

func (c *ConfigSSH) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigTodoist

type ConfigTodoist struct {
	Enabled           bool     `yaml:"enabled"`
	SuspendOnBattery  bool     `yaml:"suspendOnBattery"`
	Interval          int64    `yaml:"interval" default:"1"`
	IntervalOnBattery int64    `yaml:"intervalOnBattery" default:"5"`
	Command           string   `yaml:"command" default:"todoist"`
	ExcludedProjects  []string `yaml:"excludedProjects"`
}

func (*ConfigTodoist) UnmarshalYAML

func (c *ConfigTodoist) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigWeather

type ConfigWeather struct {
	Enabled           bool   `yaml:"enabled"`
	SuspendOnBattery  bool   `yaml:"suspendOnBattery"`
	Interval          int64  `yaml:"interval" default:"3600"`
	IntervalOnBattery int64  `yaml:"intervalOnBattery" default:"3600"`
	URL               string `yaml:"url" default:"https://wttr.in/?format=j1"`
	FallbackURL       string `yaml:"fallbackUrl" default:"https://wttr.in/Sao_Paulo?format=j1"`
}

func (*ConfigWeather) UnmarshalYAML

func (c *ConfigWeather) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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