Documentation
¶
Overview ¶
Package config defines the structure of the configuration for the `dev` tool. I expect it to be YAML, but am providing support for JSON via the struct tags to keep the options open.
There's a global configuration instance which should be populated by the controller and consumed from all other parts of the view or controller layers.
Index ¶
- Constants
- Variables
- func FilterConfigurations(fileInfos []os.FileInfo) []os.FileInfo
- func GetFiles(opt ...GetFilesOptions) ([]string, error)
- func PromptSelectLoadedConfiguration(promptMessage string, useOtherReader ...io.Reader) (string, error)
- type Config
- type Dev
- type GetFilesOptions
- type Links
- type Networks
- type Platforms
- type Repositories
- type Softwares
Constants ¶
const ( // RegexpFileName defines a regular expression pattern which is used // to decide whether a file is a `dev` configuration file based on // the file name RegexpFileName = `^\.dev(?P<label>\.[a-zA-Z0-9\-\_]+)*\.y(a)?ml$` )
Variables ¶
var Global = &Config{ Dev: Dev{}, Links: Links{}, Networks: Networks{}, Platforms: Platforms{}, Softwares: Softwares{}, Repositories: Repositories{}, }
Global contains the global configuration usable by all CLI commands, all root properties are guaranteed to exist
var Loaded = map[string]Config{}
Loaded contains a dictionary of configurations where the key equals the file's absolute path and the value containing the loaded configuration
Functions ¶
func FilterConfigurations ¶ added in v0.1.0
FilterConfigurations accepts a list of `os.FileInfo` and returns a list of `os.FileInfo`s whose file names comply to the configuration file name pattern as defined by RegexpFileName
func GetFiles ¶ added in v0.1.0
func GetFiles(opt ...GetFilesOptions) ([]string, error)
GetFiles returns a list of absolute file paths corresponding to configuration files found in 1. the current user's home directory and 2. the current working directory
Types ¶
type Config ¶ added in v0.0.7
type Config struct { Dev Dev `json:"dev" yaml:"dev,omitempty"` Links Links `json:"links" yaml:"links,omitempty"` Networks Networks `json:"networks" yaml:"networks,omitempty"` Platforms Platforms `json:"platforms" yaml:"platforms,omitempty"` Softwares Softwares `json:"softwares" yaml:"softwares,omitempty"` Repositories Repositories `json:"repositories" yaml:"repositories,omitempty"` }
func NewFromFile ¶
NewFromFile is a convenience function that reads the configuration in from a file at the provided :filePath
type Dev ¶
type Dev struct { Repository dev.Repository `json:"repository" yaml:"repository,omitempty"` Client dev.Client `json:"client" yaml:"client,omitempty"` }
Dev specifies the configurations available for the CLI tool itself
type GetFilesOptions ¶ added in v0.1.35
type GetFilesOptions struct { // ContextualWorkspacePath defines where to draw context specific configuration from ContextualWorkspacePath string // GlobalWorkspacePath defines where to draw globval configuration from GlobalWorkspacePath string }
GetFilesOptions enables parameterisation of the GetFiles function by differentiating between the contextual configuration and the global configuration
type Networks ¶
Networks represents a list of networks that the user's machine should be able to connect to
type Platforms ¶
type Platforms struct { PivotalTracker pivotaltracker.Config `json:"pivotaltracker" yaml:"pivotaltracker,omitempty"` Github github.Config `json:"github" yaml:"github,omitempty"` Gitlab gitlab.Config `json:"gitlab" yaml:"gitlab,omitempty"` Trello trello.Config `json:"trello" yaml:"trello,omitempty"` }
Platforms specifies the configurations available
func (Platforms) GetSanitized ¶
GetSanitized returns a sanitised deep copy of the current Platforms instance
type Repositories ¶
type Repositories []repository.Repository
Repositories represents a list of repositories a user should have access to on their machines
func (Repositories) GetWorkspaces ¶ added in v0.0.15
func (r Repositories) GetWorkspaces() []string
GetWorkspaces returns a list of strings corresponding to all the workspaces listed in this instance of Repositories
func (Repositories) Len ¶ added in v0.1.2
func (r Repositories) Len() int
Len implements `sort.Interface`
func (Repositories) Less ¶ added in v0.1.2
func (r Repositories) Less(i, j int) bool
Less implements `sort.Interface`
func (*Repositories) MergeWith ¶ added in v0.0.8
func (r *Repositories) MergeWith(o Repositories)
MergeWith merges the current Repositories instance with a provided Repositories instance. The merge strategy is add-only
func (*Repositories) Sort ¶ added in v0.1.2
func (r *Repositories) Sort()
Sort sorts the repositories in alphabetical order
func (Repositories) Swap ¶ added in v0.1.2
func (r Repositories) Swap(i, j int)
Swap implements `sort.Interface`