From ce18b943b8ca41961258678421ece77dd3d2fe86 Mon Sep 17 00:00:00 2001 From: Sam Coe Date: Thu, 29 Oct 2020 22:06:06 +0300 Subject: [PATCH] Export type ConfigOption and group InvalidValueError code --- internal/config/config_type.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/config/config_type.go b/internal/config/config_type.go index 7842f10b6..40533f211 100644 --- a/internal/config/config_type.go +++ b/internal/config/config_type.go @@ -10,14 +10,14 @@ import ( "gopkg.in/yaml.v3" ) -type configOption struct { +type ConfigOption struct { Key string Description string DefaultValue string AllowedValues []string } -var configOptions = []configOption{ +var configOptions = []ConfigOption{ { Key: "git_protocol", Description: "the protocol to use for git clone and push operations", @@ -42,7 +42,7 @@ var configOptions = []configOption{ }, } -func ConfigOptions() []configOption { +func ConfigOptions() []ConfigOption { return configOptions } @@ -56,6 +56,14 @@ func ValidateKey(key string) error { return fmt.Errorf("invalid key") } +type InvalidValueError struct { + ValidValues []string +} + +func (e InvalidValueError) Error() string { + return "invalid value" +} + func ValidateValue(key, value string) error { var validValues []string @@ -79,10 +87,6 @@ func ValidateValue(key, value string) error { return &InvalidValueError{ValidValues: validValues} } -func (e InvalidValueError) Error() string { - return "invalid value" -} - // This interface describes interacting with some persistent configuration for gh. type Config interface { Get(string, string) (string, error) @@ -338,10 +342,6 @@ func (c *fileConfig) GetWithSource(hostname, key string) (string, string, error) return value, defaultSource, nil } -type InvalidValueError struct { - ValidValues []string -} - func (c *fileConfig) Set(hostname, key, value string) error { if hostname == "" { return c.SetStringValue(key, value)