Documentation ¶
Overview ¶
Package file provides the capability to parse from disk a configuration file.
Index ¶
Constants ¶
const ( CtoldPathToken = "${CTOLD}" CtoldTagToken = "${CTOLD.TAG}" CtoldLastToken = "${CTOLD.REV}" DateTimeToken = "${DATETIME.NOW}" )
const ( //CtoldRepoDefault = "http://rstok3-dev02:3690/svn/FSAS_CTOLD_Source" CtoldRepoDefault = "https://github.com/ardnew/ctoldup" CtoldTagDefault = "trunk" CtoldLocalDefault = ".ctoldup" CtoldLastDefault = "" )
Variables ¶
var Permissions os.FileMode = 0600
Permissions defines the default permissions of config files written to disk.
Functions ¶
This section is empty.
Types ¶
type CompressConfig ¶
type CompressMap ¶
type CompressMap map[string]CompressConfig
type Config ¶
type Config struct { Ctold CtoldConfig `yaml:"ctold"` Merge MergeMap `yaml:"merge"` Compress CompressMap `yaml:"compress"` // contains filtered or unexported fields }
Config represents a configuration file, containing the CTOLD and destination settings.
func New ¶
New constructs a new config file at the given file path, initialized with all default data. The returned file is stored in-memory only. The Write method must be called to write the file to disk.
func Parse ¶
Parse parses the configuration file into the returned Config struct, or returns a Config struct with default configuration if the configuration file does not exist. Returns a nil Config and descriptive error if the given path is invalid.
func (*Config) CompressAll ¶
func (*Config) ReplaceTokens ¶
type CtoldConfig ¶
type CtoldConfig struct { Repo string `yaml:"repo"` Tag string `yaml:"tag"` Local string `yaml:"local"` Last string `yaml:"last"` // contains filtered or unexported fields }
func (*CtoldConfig) LastValid ¶
func (c *CtoldConfig) LastValid() bool
func (*CtoldConfig) SetPath ¶
func (c *CtoldConfig) SetPath(path string)
func (*CtoldConfig) Url ¶
func (c *CtoldConfig) Url() string
func (*CtoldConfig) Wc ¶
func (c *CtoldConfig) Wc() string
type DirectoryNotFoundError ¶
type DirectoryNotFoundError string
func (DirectoryNotFoundError) Error ¶
func (e DirectoryNotFoundError) Error() string
Error returns the error message for DirectoryNotFoundError.
type FileExistsError ¶
type FileExistsError string
func (FileExistsError) Error ¶
func (e FileExistsError) Error() string
Error returns the error message for FileExistsError.
type InvalidPathError ¶
type InvalidPathError string
func (InvalidPathError) Error ¶
func (e InvalidPathError) Error() string
Error returns the error message for InvalidPathError.
type MergeConfig ¶
type MergeMap ¶
type MergeMap map[string]MergeConfig
type NotRegularFileError ¶
type NotRegularFileError string
func (NotRegularFileError) Error ¶
func (e NotRegularFileError) Error() string
Error returns the error message for NotRegularFileError.