Documentation ¶
Index ¶
- Variables
- func DefaultWorkspaceDir(cfg Config) string
- func Dir() string
- func InferSiteURL(apiURL string) string
- func Resolve(path, home string) string
- func SetDefaultDirName(binaryName string)
- func SettingsURL(apiURL string) string
- type Config
- type FilePersister
- type InMemoryPersister
- type Persister
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultDirName is the default name used for config and workspace directories. DefaultDirName string )
Functions ¶
func DefaultWorkspaceDir ¶
DefaultWorkspaceDir provides a sensible default for the Exercism workspace. The default is different depending on the platform, in order to best match the conventions for that platform. It places the directory in the user's home path.
func Dir ¶
func Dir() string
Dir is the configured config home directory. All the cli-related config files live in this directory.
func InferSiteURL ¶
InferSiteURL guesses what the website URL is. The basis for the guess is which API we're submitting to.
func SetDefaultDirName ¶
func SetDefaultDirName(binaryName string)
SetDefaultDirName configures the default directory name based on the name of the binary.
func SettingsURL ¶
SettingsURL provides a link to where the user can find their API token.
Types ¶
type Config ¶
type Config struct { OS string Home string Dir string DefaultBaseURL string DefaultDirName string UserViperConfig *viper.Viper Persister Persister }
Config lets us inject configuration options into commands.
type FilePersister ¶
type FilePersister struct {
Dir string
}
FilePersister saves viper configs to the file system.
type InMemoryPersister ¶
type InMemoryPersister struct{}
InMemoryPersister is a noop persister for use in unit tests.