X Tutup
Skip to content

Commit ce18b94

Browse files
committed
Export type ConfigOption and group InvalidValueError code
1 parent 5c5f52c commit ce18b94

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

internal/config/config_type.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ import (
1010
"gopkg.in/yaml.v3"
1111
)
1212

13-
type configOption struct {
13+
type ConfigOption struct {
1414
Key string
1515
Description string
1616
DefaultValue string
1717
AllowedValues []string
1818
}
1919

20-
var configOptions = []configOption{
20+
var configOptions = []ConfigOption{
2121
{
2222
Key: "git_protocol",
2323
Description: "the protocol to use for git clone and push operations",
@@ -42,7 +42,7 @@ var configOptions = []configOption{
4242
},
4343
}
4444

45-
func ConfigOptions() []configOption {
45+
func ConfigOptions() []ConfigOption {
4646
return configOptions
4747
}
4848

@@ -56,6 +56,14 @@ func ValidateKey(key string) error {
5656
return fmt.Errorf("invalid key")
5757
}
5858

59+
type InvalidValueError struct {
60+
ValidValues []string
61+
}
62+
63+
func (e InvalidValueError) Error() string {
64+
return "invalid value"
65+
}
66+
5967
func ValidateValue(key, value string) error {
6068
var validValues []string
6169

@@ -79,10 +87,6 @@ func ValidateValue(key, value string) error {
7987
return &InvalidValueError{ValidValues: validValues}
8088
}
8189

82-
func (e InvalidValueError) Error() string {
83-
return "invalid value"
84-
}
85-
8690
// This interface describes interacting with some persistent configuration for gh.
8791
type Config interface {
8892
Get(string, string) (string, error)
@@ -338,10 +342,6 @@ func (c *fileConfig) GetWithSource(hostname, key string) (string, string, error)
338342
return value, defaultSource, nil
339343
}
340344

341-
type InvalidValueError struct {
342-
ValidValues []string
343-
}
344-
345345
func (c *fileConfig) Set(hostname, key, value string) error {
346346
if hostname == "" {
347347
return c.SetStringValue(key, value)

0 commit comments

Comments
 (0)
X Tutup