Documentation ¶
Index ¶
- Constants
- func GetAbsAndRelPaths(baseDir, filePath string) (string, string, error)
- func GetBaseDir() (string, error)
- func GetRelativeToBaseDir(baseDir, filePath string) (string, error)
- type File
- func (cfg *File) Commit(baseDir string) error
- func (cfg *File) CommitSelf(baseDir string) error
- func (cfg *File) GetUntrackedFiles() ([]string, error)
- func (cfg *File) Infer(baseDir, filePath string) error
- func (cfg *File) MustCommit(baseDir string)
- func (cfg *File) MustRmSchema(target string, onlyFromIndex bool)
- func (f *File) MustSerialize(baseDir string, tx *rollback.Tx)
- func (cfg *File) MustStage(baseDir string)
- func (cfg *File) MustStageSelf(baseDir string)
- func (cfgFile *File) MustWarnDiffs(baseDir, templName, instFilePath string, wErr io.Writer)
- func (cfg *File) RmSchema(target string, onlyFromIndex bool) error
- func (cfgFile *File) Serialize(baseDir string, tx *rollback.Tx) error
- func (cfg *File) Stage(baseDir string) error
- func (cfg *File) StageSelf(baseDir string) error
- func (cfgFile *File) WarnDiffs(baseDir, templName, instFilePath string, wErr io.Writer) error
- type FileInfo
- type Instance
- type JSONSchema
- type Key
- type Schemas
- type SentinelFileInfo
- type Singleton
- type Snaps
- type Snapshot
- type Template
Constants ¶
const ( DirName = ".cfg" // this dir resides in ./ FileName = ".cfg.json" // this file resides in ./ KeyfileName = "key.json" // this file resides in ./.cfg/ SnapsFileName = "snaps.json" // this file resides in ./.cfg/ SchemasDirName = ".cfg_schemas" // this file resides in ./ )
Variables ¶
This section is empty.
Functions ¶
func GetAbsAndRelPaths ¶
GetAbsAndRelPaths takes a baseDir and an absolute or relative (to cwd) file path. The absolute file path and relative (to baseDir) file paths are returned, along with any errors which occured.
func GetBaseDir ¶
func GetRelativeToBaseDir ¶
GetRelativeToBaseDir takes a baseDir and a filePath. The relative path from baseDir to filePath is returned. If filePath stats with /, it is interpreted as an absolute path. Otherwise, it is is interpreted as a relative path.
Types ¶
type File ¶
type File struct { Templates []Template `json:"templates"` Instances []Instance `json:"instances"` Singletons []Singleton `json:"singletons"` NoGit bool `json:"noGit"` }
.cfg.json is tracked by git
func MustLoadCfg ¶
func (*File) CommitSelf ¶
func (*File) GetUntrackedFiles ¶
func (*File) Infer ¶
Infer takes a baseDir and a filePath which is either an absolute path or a path relative to the cwd.
func (*File) MustCommit ¶
func (*File) MustRmSchema ¶
func (*File) MustStageSelf ¶
func (*File) MustWarnDiffs ¶
type Instance ¶
type Instance struct { FilePath string `json:"filePath"` TemplNames []string `json:"templateName"` Schema JSONSchema `json:"schema"` }
func NewInstance ¶
type JSONSchema ¶
type JSONSchema struct {
FilePath string `json:"filePath"`
}
type Key ¶
type Key struct { Email string `json:"email"` Remotes map[string]string `json:"remotes"` BaseName string `json:"baseName"` }
everything in .cfg/ (including .cfg/key.json) is not tracked by git
func MustLoadKey ¶
type SentinelFileInfo ¶
type SentinelFileInfo struct{}
func (SentinelFileInfo) IsDir ¶
func (s SentinelFileInfo) IsDir() bool
func (SentinelFileInfo) Name ¶
func (s SentinelFileInfo) Name() string
type Singleton ¶
type Singleton struct { FilePath string `json:"filePath"` Schema JSONSchema `json:"schema"` }
type Snaps ¶
everything in .cfg/ (including .cfg/snaps) is not tracked by git however, snaps are pushed to Confbase servers
func MustLoadSnaps ¶
type Template ¶
type Template struct { Name string `json:"name"` FilePath string `json:"filePath"` Schema JSONSchema `json:"schema"` }