Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct { Video VideoSection `toml:"video"` Lirc LircSection `toml:"lirc"` }
Config represents the fields in the configuration file.
func (*File) GetConfigDirPath ¶
GetConfigDirPath retrieves the absolute path to the configuration directory in an OS independent way.
Returns: (absolute path to the configuration direction, any error) If an error occurs, an empty string is returned as the path.
func (*File) GetConfigFilePath ¶
GetConfigFilePath retrieves the absolute path to the configuration file in an OS independent way.
Lookup hierarchy:
- HC_CONFIG_PATH environment variable. This will only be used if the path set in the environment variable is file that exists.
- ~/.hc/config.toml will be looked for next. This is the configuration path to the user-defined configuration.
- Internal config file in the package will be used. This is the configuration file that is used by default if the above two do not exist.
Returns: (the absolute path to configuration file, any error) If an error occurs, an empty string is returned as the path.
func (*File) Parse ¶
Parse parses the config file and reads the fields into this File. After it is parsed, you can then directly access the fields.
Example:
config.Parse() config.video.device = "/dev/device0" config.Save()
func (*File) SetupUserConfig ¶
SetupUserConfig initializes the user's configuration file setup by creating the configuration folder at ~/.hc/ and configuration file at ~/.hc/config.toml. It only creates these if they do not exist already.
Returns: (if folder is created, if file is created, any error)
type LircSection ¶
type LircSection struct {
Remote string `toml:"remote"`
}
type VideoSection ¶
type VideoSection struct {
Device string `toml:"device"`
}