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() ([]string, error)
- func PromptSelectLoadedConfiguration(promptMessage string) string
- type Config
- type Dev
- type DevClient
- type DevClientDatabase
- type DevClientNotifications
- type DevClientNotificationsTelegram
- type DevClientPlatforms
- type DevClientPlatformsGithub
- type DevRepository
- type DevRepositoryTemplate
- 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
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
func PromptSelectLoadedConfiguration ¶ added in v0.1.6
PromptSelectLoadedConfiguration does a cli prompt to ask the user to select a loaded configuration for changes to be made
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 DevRepository `json:"repository" yaml:"repository,omitempty"` Client DevClient `json:"client" yaml:"client,omitempty"` }
Dev specifies the configurations available for the CLI tool itself
type DevClient ¶
type DevClient struct { Database DevClientDatabase `json:"database" yaml:"database,omitempty"` Notifications DevClientNotifications `json:"notifications" yaml:"notifications,omitempty"` Platforms DevClientPlatforms `json:"platforms" yaml:"platforms,omitempty"` }
DevClient holds configurations related to the CLI tool
type DevClientDatabase ¶
type DevClientDatabase struct {
Path string `json:"path" yaml:"path,omitempty"`
}
DevClientDatabase holds configurations related to the data persistence mechanism of the CLI tool
func (*DevClientDatabase) MergeWith ¶ added in v0.1.4
func (dcdb *DevClientDatabase) MergeWith(o DevClientDatabase) []error
type DevClientNotifications ¶
type DevClientNotifications struct {
Telegram DevClientNotificationsTelegram `json:"telegram" yaml:"telegram,omitempty"`
}
DevClientNotifications holds configurations related to the notifications mechanisms of the CLI tool
func (*DevClientNotifications) MergeWith ¶ added in v0.1.4
func (dcn *DevClientNotifications) MergeWith(o DevClientNotifications) []error
type DevClientNotificationsTelegram ¶
type DevClientNotificationsTelegram struct { Token string `json:"token" yaml:"token,omitempty"` ID string `json:"id" yaml:"id,omitempty"` }
DevClientNotificationsTelegram holds configurations related to the telegram integration for sending notifications
func (*DevClientNotificationsTelegram) MergeWith ¶ added in v0.1.4
func (dcntg *DevClientNotificationsTelegram) MergeWith(o DevClientNotificationsTelegram) []error
type DevClientPlatforms ¶ added in v0.1.11
type DevClientPlatforms struct {
Github DevClientPlatformsGithub `json:"github" yaml:"github,omitempty"`
}
DevClientPlatforms holds configurations related to the platform integrations for individual users
func (*DevClientPlatforms) MergeWith ¶ added in v0.1.11
func (dcp *DevClientPlatforms) MergeWith(o DevClientPlatforms) []error
type DevClientPlatformsGithub ¶ added in v0.1.11
type DevClientPlatformsGithub struct { ClientID string `json:"clientId" yaml:"clientId,omitempty"` ClientSecret string `json:"clientSecret" yaml:"clientSecret,omitempty"` RedirectURI string `json:"redirectUri" yaml:"redirectUri,omitempty"` }
func (*DevClientPlatformsGithub) MergeWith ¶ added in v0.1.11
func (dcpgh *DevClientPlatformsGithub) MergeWith(o DevClientPlatformsGithub) []error
type DevRepository ¶ added in v0.1.14
type DevRepository struct {
Templates []DevRepositoryTemplate `json:"templates" yaml:"templates,omitempty"`
}
DevRepository holds client configuration for operations related to repositories
func (*DevRepository) MergeWith ¶ added in v0.1.14
func (dr *DevRepository) MergeWith(o DevRepository) []error
type DevRepositoryTemplate ¶ added in v0.1.14
type DevRepositoryTemplate struct { Name string `json:"name" yaml:"name,omitempty"` URL string `json:"url" yaml:"url,omitempty"` Path string `json:"path" yaml:"path,omitempty"` }
DevRepositoryTemplate holds configurations related to repository templates that a user can use to initialise repositories on their machine
func (DevRepositoryTemplate) GetKey ¶ added in v0.1.14
func (drt DevRepositoryTemplate) GetKey() string
GetKey returns a (hopefully) unique identifer to use for de-duplicating multiple instances of DevRepositoryTemplates
func (DevRepositoryTemplate) String ¶ added in v0.1.18
func (drt DevRepositoryTemplate) String() string
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`