all repos — searchix @ af2068f882b390778023617e6c69c9274b346cde

Search engine for NixOS, nix-darwin, home-manager and NUR users

refactor: export functions for parsing enum types
Alan Pearce alan@alanpearce.eu
Fri, 17 May 2024 12:22:14 +0200
commit

af2068f882b390778023617e6c69c9274b346cde

parent

8eb869f10a08e93f67a7feb50dc73600bc5304fb

2 files changed, 4 insertions(+), 4 deletions(-)

jump to
M internal/config/fetcher.gointernal/config/fetcher.go
@@ -28,7 +28,7 @@ 	return fmt.Sprintf("Fetcher(%d)", f)
 }
 
-func parseFetcher(name string) (Fetcher, error) {
+func ParseFetcher(name string) (Fetcher, error) {
 	switch strcase.KebabCase(name) {
 	case "channel":
 		return Channel, nil
@@ -43,7 +43,7 @@ } 
 func (f *Fetcher) UnmarshalText(text []byte) error {
 	var err error
-	*f, err = parseFetcher(string(text))
+	*f, err = ParseFetcher(string(text))
 
 	return err
 }
M internal/config/importer-type.gointernal/config/importer-type.go
@@ -25,7 +25,7 @@ 	return fmt.Sprintf("Type(%d)", i)
 }
 
-func parseType(name string) (ImporterType, error) {
+func ParseImporterType(name string) (ImporterType, error) {
 	switch strcase.KebabCase(name) {
 	case "packages":
 		return Packages, nil
@@ -38,7 +38,7 @@ } 
 func (i *ImporterType) UnmarshalText(text []byte) error {
 	var err error
-	*i, err = parseType(string(text))
+	*i, err = ParseImporterType(string(text))
 
 	return err
 }