Documentation ¶
Overview ¶
Package config contains logic related to user config files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDirectory ¶
GetDirectory returns the directory value defined in config.
Types ¶
type Config ¶
type Config struct { Directory string `json:"directory"` Editor string `json:"editor"` Templates Templates `json:"templates"` }
Config represents the options defined in the config file.
type CtxKey ¶
type CtxKey string
CtxKey is the type for the config that gets bound to the cobra context so config values can be accessed by cobra commands.
const ContextKey CtxKey = "config"
ContextKey is the key value required to access the cobra command context.
type Error ¶
type Error uint
Error is the error type.
const ( // ErrConfigNotFound is the error thrown when a config file cannot be found. ErrConfigNotFound Error = iota // ErrReadingConfigFile is the error thrown when the config file cannot be parsed. ErrReadingConfigFile // ErrUnmashallingJSON is the error thrown when the provided config file can't be unmarshalled. ErrUnmashallingJSON )
type Template ¶
type Template struct { CustomDateFormat string `json:"custom_date_format,omitempty"` File string `json:"file"` NameFormat string `json:"name_format,omitempty"` OutputDir string `json:"output_dir"` SubTemplates Templates `json:"sub_templates,omitempty"` }
Template represents the config options for a custom template file used for template and sub templates.
func (Template) GetNumberOfSubTemplates ¶
GetNumberOfSubTemplates returns the number of sub templates defined for a template.
func (Template) HasSubTemplates ¶
HasSubTemplates checks if the Template struct has sub templates. SubTemplates are offered at the pointing of using a template to give a specific version of a file.