Repository: go-go-golems/glazed
Pull request #229 (2023-03-21 00:46:24)

:tractor: Rename all helpers packages for nicer imports


Patch:
diff --git a/cmd/glaze/cmds/csv.go b/cmd/glaze/cmds/csv.go
index 7a99bdf..bd00033 100644
--- a/cmd/glaze/cmds/csv.go
+++ b/cmd/glaze/cmds/csv.go
@@ -6,7 +6,7 @@ import (
 	"github.com/go-go-golems/glazed/pkg/cmds"
 	"github.com/go-go-golems/glazed/pkg/cmds/layers"
 	"github.com/go-go-golems/glazed/pkg/cmds/parameters"
-	"github.com/go-go-golems/glazed/pkg/helpers"
+	"github.com/go-go-golems/glazed/pkg/helpers/csv"
 	"github.com/pkg/errors"
 	"os"
 )
@@ -102,12 +102,12 @@ func (c *CsvCommand) Run(
 	trimLeadingSpace, _ := ps["trim-leading-space"].(bool)
 	lazyQuotes, _ := ps["lazy-quotes"].(bool)
 
-	options := []helpers.ParseCSVOption{
-		helpers.WithComma(commaRune),
-		helpers.WithComment(commentRune),
-		helpers.WithFieldsPerRecord(fieldsPerRecord),
-		helpers.WithTrimLeadingSpace(trimLeadingSpace),
-		helpers.WithLazyQuotes(lazyQuotes),
+	options := []csv.ParseCSVOption{
+		csv.WithComma(commaRune),
+		csv.WithComment(commentRune),
+		csv.WithFieldsPerRecord(fieldsPerRecord),
+		csv.WithTrimLeadingSpace(trimLeadingSpace),
+		csv.WithLazyQuotes(lazyQuotes),
 	}
 
 	for _, arg := range inputFiles {
@@ -122,7 +122,7 @@ func (c *CsvCommand) Run(
 		}
 		defer f.Close()
 
-		s, err := helpers.ParseCSV(f, options...)
+		s, err := csv.ParseCSV(f, options...)
 		if err != nil {
 			return errors.Wrap(err, "could not parse CSV file")
 		}
diff --git a/pkg/cli/cobra.go b/pkg/cli/cobra.go
index 64c526c..31fdce3 100644
--- a/pkg/cli/cobra.go
+++ b/pkg/cli/cobra.go
@@ -9,6 +9,7 @@ import (
 	"github.com/go-go-golems/glazed/pkg/cmds/parameters"
 	"github.com/go-go-golems/glazed/pkg/formatters"
 	"github.com/go-go-golems/glazed/pkg/helpers"
+	strings2 "github.com/go-go-golems/glazed/pkg/helpers/strings"
 	"github.com/pkg/errors"
 	"github.com/spf13/cobra"
 	"github.com/spf13/pflag"
@@ -88,11 +89,11 @@ func BuildCobraCommandFromCommand(s cmds.Command, run CobraRunFunc) (*cobra.Comm
 						alias.Flags[flag.Name] = strings.Join(slice, ",")
 					case "intSlice":
 						slice, _ := cmd.Flags().GetIntSlice(flag.Name)
-						alias.Flags[flag.Name] = strings.Join(helpers.IntSliceToStringSlice(slice), ",")
+						alias.Flags[flag.Name] = strings.Join(strings2.IntSliceToStringSlice(slice), ",")
 
 					case "floatSlice":
 						slice, _ := cmd.Flags().GetFloat64Slice(flag.Name)
-						alias.Flags[flag.Name] = strings.Join(helpers.Float64SliceToStringSlice(slice), ",")
+						alias.Flags[flag.Name] = strings.Join(strings2.Float64SliceToStringSlice(slice), ",")
 
 					default:
 						alias.Flags[flag.Name] = flag.Value.String()
diff --git a/pkg/cli/settings_output.go b/pkg/cli/settings_output.go
index 1d43871..81340a4 100644
--- a/pkg/cli/settings_output.go
+++ b/pkg/cli/settings_output.go
@@ -6,7 +6,7 @@ import (
 	"github.com/go-go-golems/glazed/pkg/cmds/layers"
 	"github.com/go-go-golems/glazed/pkg/cmds/parameters"
 	"github.com/go-go-golems/glazed/pkg/formatters"
-	"github.com/go-go-golems/glazed/pkg/helpers"
+	"github.com/go-go-golems/glazed/pkg/helpers/templating"
 	"github.com/go-go-golems/glazed/pkg/middlewares/table"
 	"github.com/pkg/errors"
 	"text/template"
@@ -125,7 +125,7 @@ func (ofs *OutputFormatterSettings) CreateOutputFormatter() (formatters.OutputFo
 			ofs.TemplateFormatterSettings = &TemplateFormatterSettings{
 				TemplateFuncMaps: []template.FuncMap{
 					sprig.TxtFuncMap(),
-					helpers.TemplateFuncs,
+					templating.TemplateFuncs,
 				},
 				AdditionalData: make(map[string]interface{}),
 			}
diff --git a/pkg/cmds/parameters/cobra.go b/pkg/cmds/parameters/cobra.go
index dae800c..75852e2 100644
--- a/pkg/cmds/parameters/cobra.go
+++ b/pkg/cmds/parameters/cobra.go
@@ -2,7 +2,7 @@ package parameters
 
 import (
 	"fmt"
-	"github.com/go-go-golems/glazed/pkg/helpers"
+	"github.com/go-go-golems/glazed/pkg/helpers/cast"
 	"github.com/pkg/errors"
 	"github.com/spf13/cobra"
 	"github.com/spf13/pflag"
@@ -194,7 +194,7 @@ func AddFlagsToCobraCommand(
 			defaultValue := 0
 
 			if parameter.Default != nil {
-				defaultValue, ok = helpers.CastInterfaceToInt[int](parameter.Default)
+				defaultValue, ok = cast.CastInterfaceToInt[int](parameter.Default)
 				if !ok {
 					return errors.Errorf("Default value for parameter %s is not an integer: %v", parameter.Name, parameter.Default)
 				}
@@ -210,7 +210,7 @@ func AddFlagsToCobraCommand(
 			defaultValue := 0.0
 
 			if parameter.Default != nil {
-				defaultValue, ok = helpers.CastFloatInterfaceToFloat[float64](parameter.Default)
+				defaultValue, ok = cast.CastFloatInterfaceToFloat[float64](parameter.Default)
 				if !ok {
 					return errors.Errorf("Default value for parameter %s is not a float: %v", parameter.Name, parameter.Default)
 				}
@@ -272,7 +272,7 @@ func AddFlagsToCobraCommand(
 					}
 
 					// convert to string list
-					stringList, ok = helpers.CastList[string, interface{}](defaultValue)
+					stringList, ok = cast.CastList[string, interface{}](defaultValue)
 					if !ok {
 						return errors.Errorf("Default value for parameter %s is not a string list: %v", parameter.Name, parameter.Default)
 					}
@@ -329,7 +329,7 @@ func AddFlagsToCobraCommand(
 		case ParameterTypeIntegerList:
 			var defaultValue []int
 			if parameter.Default != nil {
-				defaultValue, ok = helpers.CastInterfaceToIntList[int](parameter.Default)
+				defaultValue, ok = cast.CastInterfaceToIntList[int](parameter.Default)
 				if !ok {
 					return errors.Errorf("Default value for parameter %s is not an integer list: %v", parameter.Name, parameter.Default)
 				}
@@ -344,7 +344,7 @@ func AddFlagsToCobraCommand(
 		case ParameterTypeFloatList:
 			var defaultValue []float64
 			if parameter.Default != nil {
-				defaultValue, ok = helpers.CastInterfaceToFloatList[float64](parameter.Default)
+				defaultValue, ok = cast.CastInterfaceToFloatList[float64](parameter.Default)
 				if !ok {
 					return errors.Errorf("Default value for parameter %s is not a float list: %v", parameter.Name, parameter.Default)
 				}
diff --git a/pkg/cmds/parameters/parameters.go b/pkg/cmds/parameters/parameters.go
index 5ed1509..4f85bcf 100644
--- a/pkg/cmds/parameters/parameters.go
+++ b/pkg/cmds/parameters/parameters.go
@@ -6,7 +6,8 @@ import (
 	"encoding/json"
 	"fmt"
 	"github.com/araddon/dateparse"
-	"github.com/go-go-golems/glazed/pkg/helpers"
+	"github.com/go-go-golems/glazed/pkg/helpers/cast"
+	reflect2 "github.com/go-go-golems/glazed/pkg/helpers/reflect"
 	"github.com/pkg/errors"
 	"github.com/tj/go-naturaldate"
 	"gopkg.in/yaml.v3"
@@ -108,20 +109,20 @@ func (p *ParameterDefinition) SetDefaultFromInterface(i interface{}) error {
 		}
 		p.Default = v
 	case ParameterTypeInteger:
-		v, ok := helpers.CastInterfaceToInt[int64](i)
+		v, ok := cast.CastInterfaceToInt[int64](i)
 		if !ok {
 			return errors.Errorf("expected int64 for parameter %s, got %T", p.Name, i)
 		}
 		p.Default = v
 	case ParameterTypeFloat:
 
-		v, ok := helpers.CastFloatInterfaceToFloat[float64](i)
+		v, ok := cast.CastFloatInterfaceToFloat[float64](i)
 		if !ok {
 			return errors.Errorf("expected float64 for parameter %s, got %T", p.Name, i)
 		}
 		p.Default = v
 	case ParameterTypeStringList:
-		v, ok := helpers.CastList2[string, interface{}](i)
+		v, ok := cast.CastList2[string, interface{}](i)
 		if !ok {
 			return errors.Errorf("expected string list for parameter %s, got %T", p.Name, i)
 		}
@@ -129,13 +130,13 @@ func (p *ParameterDefinition) SetDefaultFromInterface(i interface{}) error {
 	case ParameterTypeDate:
 		p.Default = i.(time.Time).Format(time.RFC3339)
 	case ParameterTypeIntegerList:
-		v, ok := helpers.CastInterfaceToIntList[int64](i)
+		v, ok := cast.CastInterfaceToIntList[int64](i)
 		if !ok {
 			return errors.Errorf("expected integer list for parameter %s, got %T", p.Name, i)
 		}
 		p.Default = v
 	case ParameterTypeFloatList:
-		v, ok := helpers.CastInterfaceToFloatList[float64](i)
+		v, ok := cast.CastInterfaceToFloatList[float64](i)
 		if !ok {
 			return errors.Errorf("expected float list for parameter %s, got %T", p.Name, i)
 		}
@@ -145,25 +146,25 @@ func (p *ParameterDefinition) SetDefaultFromInterface(i interface{}) error {
 	case ParameterTypeStringFromFile:
 		p.Default = i.(string)
 	case ParameterTypeStringListFromFile:
-		v, ok := helpers.CastList2[string, interface{}](i)
+		v, ok := cast.CastList2[string, interface{}](i)
 		if !ok {
 			return errors.Errorf("expected string list for parameter %s, got %T", p.Name, i)
 		}
 		p.Default = v
 	case ParameterTypeKeyValue:
-		v, ok := helpers.CastInterfaceToStringMap[string, interface{}](i)
+		v, ok := cast.CastInterfaceToStringMap[string, interface{}](i)
 		if !ok {
 			return errors.Errorf("expected string map for parameter %s, got %T", p.Name, i)
 		}
 		p.Default = v
 	case ParameterTypeObjectFromFile:
-		v, ok := helpers.CastInterfaceToStringMap[interface{}, interface{}](i)
+		v, ok := cast.CastInterfaceToStringMap[interface{}, interface{}](i)
 		if !ok {
 			return errors.Errorf("expected object for parameter %s, got %T", p.Name, i)
 		}
 		p.Default = v
 	case ParameterTypeObjectListFromFile:
-		v, ok := helpers.CastList2[map[string]interface{}, interface{}](i)
+		v, ok := cast.CastList2[map[string]interface{}, interface{}](i)
 		if !ok {
 			return errors.Errorf("expected object list for parameter %s, got %T", p.Name, i)
 		}
@@ -193,7 +194,7 @@ func (p *ParameterDefinition) SetDefaultFromValue(value reflect.Value) error {
 	case ParameterTypeFloat:
 		p.Default = value.Float()
 	case ParameterTypeStringList:
-		v, ok := helpers.CastList2[string, interface{}](value.Interface())
+		v, ok := cast.CastList2[string, interface{}](value.Interface())
 		if !ok {
 			return errors.Errorf("expected string list for parameter %s, got %T", p.Name, value.Interface())
 		}
@@ -201,13 +202,13 @@ func (p *ParameterDefinition) SetDefaultFromValue(value reflect.Value) error {
 	case ParameterTypeDate:
 		p.Default = value.Interface().(time.Time).Format(time.RFC3339)
 	case ParameterTypeIntegerList:
-		v, ok := helpers.CastList2[int64, interface{}](value.Interface())
+		v, ok := cast.CastList2[int64, interface{}](value.Interface())
 		if !ok {
 			return errors.Errorf("expected integer list for parameter %s, got %T", p.Name, value.Interface())
 		}
 		p.Default = v
 	case ParameterTypeFloatList:
-		v, ok := helpers.CastList2[float64, interface{}](value.Interface())
+		v, ok := cast.CastList2[float64, interface{}](value.Interface())
 		if !ok {
 			return errors.Errorf("expected float list for parameter %s, got %T", p.Name, value.Interface())
 		}
@@ -217,25 +218,25 @@ func (p *ParameterDefinition) SetDefaultFromValue(value reflect.Value) error {
 	case ParameterTypeStringFromFile:
 		p.Default = value.String()
 	case ParameterTypeStringListFromFile:
-		v, ok := helpers.CastList2[string, interface{}](value.Interface())
+		v, ok := cast.CastList2[string, interface{}](value.Interface())
 		if !ok {
 			return errors.Errorf("expected string list for parameter %s, got %T", p.Name, value.Interface())
 		}
 		p.Default = v
 	case ParameterTypeKeyValue:
-		v, ok := helpers.CastInterfaceToStringMap[string, interface{}](value.Interface())
+		v, ok := cast.CastInterfaceToStringMap[string, interface{}](value.Interface())
 		if !ok {
 			return errors.Errorf("expected string map for parameter %s, got %T", p.Name, value.Interface())
 		}
 		p.Default = v
 	case ParameterTypeObjectFromFile:
-		v, ok := helpers.CastInterfaceToStringMap[interface{}, interface{}](value.Interface())
+		v, ok := cast.CastInterfaceToStringMap[interface{}, interface{}](value.Interface())
 		if !ok {
 			return errors.Errorf("expected object for parameter %s, got %T", p.Name, value.Interface())
 		}
 		p.Default = v
 	case ParameterTypeObjectListFromFile:
-		v, ok := helpers.CastList2[map[string]interface{}, interface{}](value.Interface())
+		v, ok := cast.CastList2[map[string]interface{}, interface{}](value.Interface())
 		if !ok {
 			return errors.Errorf("expected object list for parameter %s, got %T", p.Name, value.Interface())
 		}
@@ -268,15 +269,15 @@ func (p *ParameterDefinition) SetValueFromDefault(value reflect.Value) error {
 		}
 	case ParameterTypeInteger:
 		if p.Default == nil {
-			return helpers.SetReflectValue(value, 0)
+			return reflect2.SetReflectValue(value, 0)
 		} else {
-			return helpers.SetReflectValue(value, p.Default)
+			return reflect2.SetReflectValue(value, p.Default)
 		}
 	case ParameterTypeFloat:
 		if p.Default == nil {
-			return helpers.SetReflectValue(value, 0.0)
+			return reflect2.SetReflectValue(value, 0.0)
 		} else {
-			return helpers.SetReflectValue(value, p.Default)
+			return reflect2.SetReflectValue(value, p.Default)
 		}
 	case ParameterTypeStringList:
 		if p.Default == nil {
@@ -299,15 +300,15 @@ func (p *ParameterDefinition) SetValueFromDefault(value reflect.Value) error {
 		}
 	case ParameterTypeIntegerList:
 		if p.Default == nil {
-			return helpers.SetReflectValue(value, []int64{})
+			return reflect2.SetReflectValue(value, []int64{})
 		} else {
-			return helpers.SetReflectValue(value, p.Default)
+			return reflect2.SetReflectValue(value, p.Default)
 		}
 	case ParameterTypeFloatList:
 		if p.Default == nil {
-			return helpers.SetReflectValue(value, []float64{})
+			return reflect2.SetReflectValue(value, []float64{})
 		} else {
-			return helpers.SetReflectValue(value, p.Default)
+			return reflect2.SetReflectValue(value, p.Default)
 		}
 	case ParameterTypeChoice:
 		if p.Default == nil {
@@ -325,7 +326,7 @@ func (p *ParameterDefinition) SetValueFromDefault(value reflect.Value) error {
 		if p.Default == nil {
 			value.Set(reflect.ValueOf([]string{}))
 		} else {
-			list, b := helpers.CastList2[string, interface{}](p.Default)
+			list, b := cast.CastList2[string, interface{}](p.Default)
 			if !b {
 				return errors.Errorf("default value for parameter %s is not a list of strings", p.Name)
 			}
@@ -335,7 +336,7 @@ func (p *ParameterDefinition) SetValueFromDefault(value reflect.Value) error {
 		if p.Default == nil {
 			value.Set(reflect.ValueOf([]map[string]interface{}{}))
 		} else {
-			list2, b := helpers.CastList2[map[string]interface{}, interface{}](p.Default)
+			list2, b := cast.CastList2[map[string]interface{}, interface{}](p.Default)
 			if !b {
 				return errors.Errorf("default value for parameter %s is not a list of maps", p.Name)
 			}
@@ -355,7 +356,7 @@ func (p *ParameterDefinition) SetValueFromDefault(value reflect.Value) error {
 			if !ok {
 				return errors.Errorf("default value for parameter %s is not a map[string]interface{}", p.Name)
 			}
-			v2, ok := helpers.CastStringMap[string, interface{}](v)
+			v2, ok := cast.CastStringMap[string, interface{}](v)
 			if !ok {
 				return errors.Errorf("default value for parameter %s is not a map[string]interface{}", p.Name)
 			}
@@ -522,14 +523,14 @@ func InitializeStructFromParameters(s interface{}, ps map[string]interface{}) er
 					return errors.Wrapf(err, "failed to initialize struct for %s", v)
 				}
 			default:
-				err := helpers.SetReflectValue(value.Elem(), v_)
+				err := reflect2.SetReflectValue(value.Elem(), v_)
 				if err != nil {
 					return errors.Wrapf(err, "failed to set value for %s", v)
 				}
 			}
 
 		} else {
-			err := helpers.SetReflectValue(value, v_)
+			err := reflect2.SetReflectValue(value, v_)
 			if err != nil {
 				return errors.Wrapf(err, "failed to set value for %s", v)
 			}
@@ -641,13 +642,13 @@ func (p *ParameterDefinition) CheckParameterDefaultValueValidity() error {
 		}
 
 	case ParameterTypeInteger:
-		_, ok := helpers.CastInterfaceToInt[int64](p.Default)
+		_, ok := cast.CastInterfaceToInt[int64](p.Default)
 		if !ok {
 			return errors.Errorf("Default value for parameter %s is not an integer: %v", p.Name, p.Default)
 		}
 
 	case ParameterTypeFloat:
-		_, ok := helpers.CastFloatInterfaceToFloat[float64](p.Default)
+		_, ok := cast.CastFloatInterfaceToFloat[float64](p.Default)
 		if !ok {
 			return errors.Errorf("Default value for parameter %s is not a float: %v", p.Name, p.Default)
 		}
@@ -688,13 +689,13 @@ func (p *ParameterDefinition) CheckParameterDefaultValueValidity() error {
 		}
 
 	case ParameterTypeIntegerList:
-		_, ok := helpers.CastInterfaceToIntList[int64](p.Default)
+		_, ok := cast.CastInterfaceToIntList[int64](p.Default)
 		if !ok {
 			return errors.Errorf("Default value for parameter %s is not an integer list: %v", p.Name, p.Default)
 		}
 
 	case ParameterTypeFloatList:
-		_, ok := helpers.CastInterfaceToFloatList[float64](p.Default)
+		_, ok := cast.CastInterfaceToFloatList[float64](p.Default)
 		if !ok {
 			return errors.Errorf("Default value for parameter %s is not a float list: %v", p.Name, p.Default)
 		}
@@ -727,7 +728,7 @@ func (p *ParameterDefinition) CheckParameterDefaultValueValidity() error {
 				return errors.Errorf("Default value for parameter %s is not a key value list: %v", p.Name, p.Default)
 			}
 
-			_, ok = helpers.CastStringMap[string, interface{}](defaultValue)
+			_, ok = cast.CastStringMap[string, interface{}](defaultValue)
 			if !ok {
 				return errors.Errorf("Default value for parameter %s is not a key value list: %v", p.Name, p.Default)
 			}
diff --git a/pkg/cmds/parameters/render.go b/pkg/cmds/parameters/render.go
index 8952c11..9ac7830 100644
--- a/pkg/cmds/parameters/render.go
+++ b/pkg/cmds/parameters/render.go
@@ -2,7 +2,7 @@ package parameters
 
 import (
 	"fmt"
-	"github.com/go-go-golems/glazed/pkg/helpers"
+	"github.com/go-go-golems/glazed/pkg/helpers/cast"
 	"github.com/pkg/errors"
 	"strings"
 )
@@ -67,7 +67,7 @@ func RenderValue(type_ ParameterType, value interface{}) (string, error) {
 		if !ok {
 			return "", errors.Errorf("expected []interface{}, got %T", value)
 		}
-		l, ok := helpers.CastInterfaceListToIntList[int64](v)
+		l, ok := cast.CastInterfaceListToIntList[int64](v)
 		if !ok {
 			return "", errors.Errorf("expected []int64, got %T", value)
 		}
@@ -82,7 +82,7 @@ func RenderValue(type_ ParameterType, value interface{}) (string, error) {
 		if !ok {
 			return "", errors.Errorf("expected []interface{}, got %T", value)
 		}
-		l, ok := helpers.CastInterfaceListToFloatList[float64](v)
+		l, ok := cast.CastInterfaceListToFloatList[float64](v)
 		if !ok {
 			return "", errors.Errorf("expected []float64, got %T", value)
 		}
diff --git a/pkg/formatters/excel.go b/pkg/formatters/excel.go
index b7d88fe..cae3a0f 100644
--- a/pkg/formatters/excel.go
+++ b/pkg/formatters/excel.go
@@ -2,7 +2,7 @@ package formatters
 
 import (
 	"fmt"
-	"github.com/go-go-golems/glazed/pkg/helpers"
+	strings2 "github.com/go-go-golems/glazed/pkg/helpers/strings"
 	"github.com/go-go-golems/glazed/pkg/middlewares"
 	"github.com/go-go-golems/glazed/pkg/types"
 	"github.com/xuri/excelize/v2"
@@ -81,7 +81,7 @@ func (E *ExcelOutputFormatter) Output() (string, error) {
 	}
 
 	for j, col := range E.Table.Columns {
-		colIndex := helpers.ToAlphaString(j + 1)
+		colIndex := strings2.ToAlphaString(j + 1)
 		cellIndex := colIndex + "1"
 		rowKeyToColumn[col] = colIndex
 		err = f.SetCellValue(E.SheetName, cellIndex, col)
diff --git a/pkg/help/cobra.go b/pkg/help/cobra.go
index 8d58afe..052c0b4 100644
--- a/pkg/help/cobra.go
+++ b/pkg/help/cobra.go
@@ -5,7 +5,7 @@ import (
 	"fmt"
 	"github.com/Masterminds/sprig"
 	glazed_cobra "github.com/go-go-golems/glazed/pkg/cmds/layers"
-	"github.com/go-go-golems/glazed/pkg/helpers"
+	"github.com/go-go-golems/glazed/pkg/helpers/templating"
 	"github.com/spf13/cobra"
 	"strings"
 	"text/template"
@@ -65,7 +65,7 @@ func renderCommandHelpPage(c *cobra.Command, options *RenderOptions, hs *HelpSys
 
 	data, noResultsFound := hs.ComputeRenderData(userQuery)
 
-	t.Funcs(helpers.TemplateFuncs).Funcs(sprig.TxtFuncMap())
+	t.Funcs(templating.TemplateFuncs).Funcs(sprig.TxtFuncMap())
 
 	var tmpl string
 	if options.ListSections || noResultsFound {
diff --git a/pkg/help/help.go b/pkg/help/help.go
index 08bb19b..6327027 100644
--- a/pkg/help/help.go
+++ b/pkg/help/help.go
@@ -4,7 +4,7 @@ import (
 	"bytes"
 	"fmt"
 	"github.com/adrg/frontmatter"
-	"github.com/go-go-golems/glazed/pkg/helpers"
+	strings2 "github.com/go-go-golems/glazed/pkg/helpers/strings"
 	"github.com/pkg/errors"
 	"github.com/spf13/cobra"
 	"io/fs"
@@ -90,15 +90,15 @@ type Section struct {
 }
 
 func (s *Section) IsForCommand(command string) bool {
-	return helpers.StringInSlice(command, s.Commands)
+	return strings2.StringInSlice(command, s.Commands)
 }
 
 func (s *Section) IsForFlag(flag string) bool {
-	return helpers.StringInSlice(flag, s.Flags)
+	return strings2.StringInSlice(flag, s.Flags)
 }
 
 func (s *Section) IsForTopic(topic string) bool {
-	return helpers.StringInSlice(topic, s.Topics)
+	return strings2.StringInSlice(topic, s.Topics)
 }
 
 // these should potentially be scoped by command
@@ -207,15 +207,15 @@ func LoadSectionFromMarkdown(markdownBytes []byte) (*Section, error) {
 	section.Content = string(rest)
 
 	if topics, ok := metaData["Topics"]; ok {
-		section.Topics = helpers.InterfaceToStringList(topics)
+		section.Topics = strings2.InterfaceToStringList(topics)
 	}
 
 	if flags, ok := metaData["Flags"]; ok {
-		section.Flags = helpers.InterfaceToStringList(flags)
+		section.Flags = strings2.InterfaceToStringList(flags)
 	}
 
 	if commands, ok := metaData["Commands"]; ok {
-		section.Commands = helpers.InterfaceToStringList(commands)
+		section.Commands = strings2.InterfaceToStringList(commands)
 	}
 
 	if isTopLevel, ok := metaData["IsTopLevel"]; ok {
diff --git a/pkg/help/render.go b/pkg/help/render.go
index 829b756..c312aea 100644
--- a/pkg/help/render.go
+++ b/pkg/help/render.go
@@ -3,12 +3,12 @@ package help
 import (
 	_ "embed"
 	"fmt"
+	"github.com/go-go-golems/glazed/pkg/helpers/templating"
 	"os"
 	"strings"
 	"text/template"
 
 	"github.com/charmbracelet/glamour"
-	"github.com/go-go-golems/glazed/pkg/helpers"
 	tsize "github.com/kopoli/go-terminal-size"
 	"github.com/mattn/go-isatty"
 )
@@ -115,7 +115,7 @@ func (hs *HelpSystem) RenderTopicHelp(
 	data, noResultsFound := hs.ComputeRenderData(userQuery)
 
 	t := template.New("topic")
-	t.Funcs(helpers.TemplateFuncs)
+	t.Funcs(templating.TemplateFuncs)
 	tmpl := HELP_TOPIC_TEMPLATE
 
 	if options.ShowShortTopic {
diff --git a/pkg/helpers/cast.go b/pkg/helpers/cast/cast.go
similarity index 99%
rename from pkg/helpers/cast.go
rename to pkg/helpers/cast/cast.go
index 8baa88a..ffbc7df 100644
--- a/pkg/helpers/cast.go
+++ b/pkg/helpers/cast/cast.go
@@ -1,4 +1,4 @@
-package helpers
+package cast
 
 type Number interface {
 	int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | uintptr | float32 | float64
diff --git a/pkg/helpers/compare/compare.go b/pkg/helpers/compare/compare.go
index eee48d4..b53cb5d 100644
--- a/pkg/helpers/compare/compare.go
+++ b/pkg/helpers/compare/compare.go
@@ -1,14 +1,16 @@
 package compare
 
-import "github.com/go-go-golems/glazed/pkg/helpers"
+import (
+	"github.com/go-go-golems/glazed/pkg/helpers/cast"
+)
 
 func IsLowerThan(a, b interface{}) bool {
 	if IsOfNumberType(a) && IsOfNumberType(b) {
-		af, ok := helpers.CastNumberInterfaceToFloat[float64](a)
+		af, ok := cast.CastNumberInterfaceToFloat[float64](a)
 		if !ok {
 			return false
 		}
-		bf, ok := helpers.CastNumberInterfaceToFloat[float64](b)
+		bf, ok := cast.CastNumberInterfaceToFloat[float64](b)
 		if !ok {
 			return false
 		}
diff --git a/pkg/helpers/csv.go b/pkg/helpers/csv/csv.go
similarity index 99%
rename from pkg/helpers/csv.go
rename to pkg/helpers/csv/csv.go
index 9eaf282..d5fdb4a 100644
--- a/pkg/helpers/csv.go
+++ b/pkg/helpers/csv/csv.go
@@ -1,4 +1,4 @@
-package helpers
+package csv
 
 import (
 	"encoding/csv"
diff --git a/pkg/helpers/file_formats.go b/pkg/helpers/files/file_formats.go
similarity index 98%
rename from pkg/helpers/file_formats.go
rename to pkg/helpers/files/file_formats.go
index 38222e0..df635dc 100644
--- a/pkg/helpers/file_formats.go
+++ b/pkg/helpers/files/file_formats.go
@@ -1,4 +1,4 @@
-package helpers
+package files
 
 import (
 	"encoding/json"
diff --git a/pkg/helpers/files.go b/pkg/helpers/files/files.go
similarity index 95%
rename from pkg/helpers/files.go
rename to pkg/helpers/files/files.go
index 881b336..f0ef76e 100644
--- a/pkg/helpers/files.go
+++ b/pkg/helpers/files/files.go
@@ -1,4 +1,4 @@
-package helpers
+package files
 
 import (
 	"encoding/json"
diff --git a/pkg/helpers/maps.go b/pkg/helpers/maps/maps.go
similarity index 96%
rename from pkg/helpers/maps.go
rename to pkg/helpers/maps/maps.go
index b3401c8..e0922d2 100644
--- a/pkg/helpers/maps.go
+++ b/pkg/helpers/maps/maps.go
@@ -1,4 +1,4 @@
-package helpers
+package maps
 
 import (
 	"reflect"
diff --git a/pkg/helpers/reflect.go b/pkg/helpers/reflect/reflect.go
similarity index 87%
rename from pkg/helpers/reflect.go
rename to pkg/helpers/reflect/reflect.go
index db959f0..65db8e8 100644
--- a/pkg/helpers/reflect.go
+++ b/pkg/helpers/reflect/reflect.go
@@ -1,7 +1,8 @@
-package helpers
+package reflect
 
 import (
 	"fmt"
+	"github.com/go-go-golems/glazed/pkg/helpers/cast"
 	"reflect"
 )
 
@@ -176,7 +177,7 @@ func SetReflectValue(value reflect.Value, v interface{}) error {
 				return nil
 			}
 			if s, ok := v.([]interface{}); ok {
-				v2_, ok := CastList[string, interface{}](s)
+				v2_, ok := cast.CastList[string, interface{}](s)
 				if !ok {
 					return fmt.Errorf("cannot cast %T to []string", v)
 				}
@@ -236,7 +237,7 @@ func SetReflectValue(value reflect.Value, v interface{}) error {
 			}
 
 			if m, ok := v.(map[string]interface{}); ok {
-				v2_, ok := CastStringMap[string, interface{}](m)
+				v2_, ok := cast.CastStringMap[string, interface{}](m)
 				if !ok {
 					return fmt.Errorf("cannot cast %T to map[string]string", v)
 				}
@@ -251,7 +252,7 @@ func SetReflectValue(value reflect.Value, v interface{}) error {
 			}
 
 			if m, ok := v.(map[string]string); ok {
-				v2_, ok := CastStringMap[interface{}, string](m)
+				v2_, ok := cast.CastStringMap[interface{}, string](m)
 				if !ok {
 					return fmt.Errorf("cannot cast %T to map[string]interface{}", v)
 				}
@@ -270,9 +271,9 @@ func SetReflectValue(value reflect.Value, v interface{}) error {
 	}
 }
 
-func SetIntListReflectValue[To Number](value reflect.Value, v interface{}) error {
+func SetIntListReflectValue[To cast.Number](value reflect.Value, v interface{}) error {
 	if s, ok := v.([]int64); ok {
-		s2, ok := CastToNumberList[To, int64](s)
+		s2, ok := cast.CastToNumberList[To, int64](s)
 		if !ok {
 			return fmt.Errorf("cannot cast %T to []%T", v, To(0))
 		}
@@ -281,7 +282,7 @@ func SetIntListReflectValue[To Number](value reflect.Value, v interface{}) error
 	}
 
 	if s, ok := v.([]int); ok {
-		s2, ok := CastToNumberList[To, int](s)
+		s2, ok := cast.CastToNumberList[To, int](s)
 		if !ok {
 			return fmt.Errorf("cannot cast %T to []%T", v, To(0))
 		}
@@ -290,7 +291,7 @@ func SetIntListReflectValue[To Number](value reflect.Value, v interface{}) error
 	}
 
 	if s, ok := v.([]int8); ok {
-		s2, ok := CastToNumberList[To, int8](s)
+		s2, ok := cast.CastToNumberList[To, int8](s)
 		if !ok {
 			return fmt.Errorf("cannot cast %T to []%T", v, To(0))
 		}
@@ -299,7 +300,7 @@ func SetIntListReflectValue[To Number](value reflect.Value, v interface{}) error
 	}
 
 	if s, ok := v.([]int16); ok {
-		s2, ok := CastToNumberList[To, int16](s)
+		s2, ok := cast.CastToNumberList[To, int16](s)
 		if !ok {
 			return fmt.Errorf("cannot cast %T to []%T", v, To(0))
 		}
@@ -308,7 +309,7 @@ func SetIntListReflectValue[To Number](value reflect.Value, v interface{}) error
 	}
 
 	if s, ok := v.([]int32); ok {
-		s2, ok := CastToNumberList[To, int32](s)
+		s2, ok := cast.CastToNumberList[To, int32](s)
 		if !ok {
 			return fmt.Errorf("cannot cast %T to []%T", v, To(0))
 		}
@@ -317,7 +318,7 @@ func SetIntListReflectValue[To Number](value reflect.Value, v interface{}) error
 	}
 
 	if s, ok := v.([]uint64); ok {
-		s2, ok := CastToNumberList[To, uint64](s)
+		s2, ok := cast.CastToNumberList[To, uint64](s)
 		if !ok {
 			return fmt.Errorf("cannot cast %T to []%T", v, To(0))
 		}
@@ -326,7 +327,7 @@ func SetIntListReflectValue[To Number](value reflect.Value, v interface{}) error
 	}
 
 	if s, ok := v.([]uint); ok {
-		s2, ok := CastToNumberList[To, uint](s)
+		s2, ok := cast.CastToNumberList[To, uint](s)
 		if !ok {
 			return fmt.Errorf("cannot cast %T to []%T", v, To(0))
 		}
@@ -335,7 +336,7 @@ func SetIntListReflectValue[To Number](value reflect.Value, v interface{}) error
 	}
 
 	if s, ok := v.([]uint8); ok {
-		s2, ok := CastToNumberList[To, uint8](s)
+		s2, ok := cast.CastToNumberList[To, uint8](s)
 		if !ok {
 			return fmt.Errorf("cannot cast %T to []%T", v, To(0))
 		}
@@ -344,7 +345,7 @@ func SetIntListReflectValue[To Number](value reflect.Value, v interface{}) error
 	}
 
 	if s, ok := v.([]uint16); ok {
-		s2, ok := CastToNumberList[To, uint16](s)
+		s2, ok := cast.CastToNumberList[To, uint16](s)
 		if !ok {
 			return fmt.Errorf("cannot cast %T to []%T", v, To(0))
 		}
@@ -353,7 +354,7 @@ func SetIntListReflectValue[To Number](value reflect.Value, v interface{}) error
 	}
 
 	if s, ok := v.([]uint32); ok {
-		s2, ok := CastToNumberList[To, uint32](s)
+		s2, ok := cast.CastToNumberList[To, uint32](s)
 		if !ok {
 			return fmt.Errorf("cannot cast %T to []%T", v, To(0))
 		}
@@ -362,11 +363,11 @@ func SetIntListReflectValue[To Number](value reflect.Value, v interface{}) error
 	}
 
 	if s, ok := v.([]interface{}); ok {
-		v2_, ok := CastList[int, interface{}](s)
+		v2_, ok := cast.CastList[int, interface{}](s)
 		if !ok {
 			return fmt.Errorf("cannot cast %T to []%T", v, To(0))
 		}
-		v3_, ok := CastToNumberList[To, int](v2_)
+		v3_, ok := cast.CastToNumberList[To, int](v2_)
 		if !ok {
 			return fmt.Errorf("cannot cast %T to []%T", v, To(0))
 		}
@@ -377,9 +378,9 @@ func SetIntListReflectValue[To Number](value reflect.Value, v interface{}) error
 	return fmt.Errorf("cannot set reflect.Value of type %s from %T", value.Kind(), v)
 }
 
-func SetFloatListReflectValue[To Number](value reflect.Value, v interface{}) error {
+func SetFloatListReflectValue[To cast.Number](value reflect.Value, v interface{}) error {
 	if s, ok := v.([]float64); ok {
-		s2, ok := CastToNumberList[To, float64](s)
+		s2, ok := cast.CastToNumberList[To, float64](s)
 		if !ok {
 			return fmt.Errorf("cannot cast %T to []%T", v, To(0))
 		}
@@ -388,7 +389,7 @@ func SetFloatListReflectValue[To Number](value reflect.Value, v interface{}) err
 	}
 
 	if s, ok := v.([]float32); ok {
-		s2, ok := CastToNumberList[To, float32](s)
+		s2, ok := cast.CastToNumberList[To, float32](s)
 		if !ok {
 			return fmt.Errorf("cannot cast %T to []%T", v, To(0))
 		}
@@ -397,11 +398,11 @@ func SetFloatListReflectValue[To Number](value reflect.Value, v interface{}) err
 	}
 
 	if s, ok := v.([]interface{}); ok {
-		v2_, ok := CastList[float64, interface{}](s)
+		v2_, ok := cast.CastList[float64, interface{}](s)
 		if !ok {
 			return fmt.Errorf("cannot cast %T to []%T", v, To(0))
 		}
-		v3_, ok := CastToNumberList[To, float64](v2_)
+		v3_, ok := cast.CastToNumberList[To, float64](v2_)
 		if !ok {
 			return fmt.Errorf("cannot cast %T to []%T", v, To(0))
 		}
diff --git a/pkg/helpers/strings.go b/pkg/helpers/strings/strings.go
similarity index 98%
rename from pkg/helpers/strings.go
rename to pkg/helpers/strings/strings.go
index b3eb9da..9e4c759 100644
--- a/pkg/helpers/strings.go
+++ b/pkg/helpers/strings/strings.go
@@ -1,4 +1,4 @@
-package helpers
+package strings
 
 import "fmt"
 
diff --git a/pkg/helpers/templating.go b/pkg/helpers/templating/templating.go
similarity index 99%
rename from pkg/helpers/templating.go
rename to pkg/helpers/templating/templating.go
index e4c220b..5e5d088 100644
--- a/pkg/helpers/templating.go
+++ b/pkg/helpers/templating/templating.go
@@ -1,10 +1,11 @@
-package helpers
+package templating
 
 import (
 	"bytes"
 	"fmt"
 	"github.com/Masterminds/sprig"
 	"github.com/bmatcuk/doublestar/v4"
+	"github.com/go-go-golems/glazed/pkg/helpers/cast"
 	"github.com/pkg/errors"
 	"gopkg.in/yaml.v3"
 	html "html/template"
@@ -410,7 +411,7 @@ func stripNewlines(s string) string {
 
 // rpad adds padding to the right of a string.
 func rpad(s string, padding_ interface{}) string {
-	padding, ok := CastInterfaceToInt[int](padding_)
+	padding, ok := cast.CastInterfaceToInt[int](padding_)
 	if !ok {
 		panic("padding must be an int")
 	}
diff --git a/pkg/middlewares/object/object.go b/pkg/middlewares/object/object.go
index c9075be..cc60377 100644
--- a/pkg/middlewares/object/object.go
+++ b/pkg/middlewares/object/object.go
@@ -3,7 +3,7 @@ package object
 import (
 	"bytes"
 	"github.com/Masterminds/sprig"
-	"github.com/go-go-golems/glazed/pkg/helpers"
+	"github.com/go-go-golems/glazed/pkg/helpers/templating"
 	"github.com/go-go-golems/glazed/pkg/types"
 	"text/template"
 )
@@ -26,7 +26,7 @@ func NewObjectGoTemplateMiddleware(
 	for columnName, templateString := range templateStrings {
 		tmpl, err := template.New("row").
 			Funcs(sprig.TxtFuncMap()).
-			Funcs(helpers.TemplateFuncs).
+			Funcs(templating.TemplateFuncs).
 			Parse(templateString)
 		if err != nil {
 			return nil, err
diff --git a/pkg/middlewares/table/table.go b/pkg/middlewares/table/table.go
index 9a21242..a763fd7 100644
--- a/pkg/middlewares/table/table.go
+++ b/pkg/middlewares/table/table.go
@@ -4,7 +4,7 @@ import (
 	"bytes"
 	"fmt"
 	"github.com/Masterminds/sprig"
-	"github.com/go-go-golems/glazed/pkg/helpers"
+	"github.com/go-go-golems/glazed/pkg/helpers/templating"
 	"github.com/go-go-golems/glazed/pkg/types"
 	"gopkg.in/yaml.v3"
 	"regexp"
@@ -362,7 +362,7 @@ func NewRowGoTemplateMiddleware(
 	for columnName, templateString := range templateStrings {
 		tmpl, err := template.New("row").
 			Funcs(sprig.TxtFuncMap()).
-			Funcs(helpers.TemplateFuncs).
+			Funcs(templating.TemplateFuncs).
 			Parse(templateString)
 		if err != nil {
 			return nil, err


Test patch:
diff --git a/pkg/formatters/csv_test.go b/pkg/formatters/csv_test.go
index bd392da..da6c56e 100644
--- a/pkg/formatters/csv_test.go
+++ b/pkg/formatters/csv_test.go
@@ -1,7 +1,7 @@
 package formatters
 
 import (
-	"github.com/go-go-golems/glazed/pkg/helpers"
+	"github.com/go-go-golems/glazed/pkg/helpers/csv"
 	"github.com/go-go-golems/glazed/pkg/middlewares/table"
 	"github.com/go-go-golems/glazed/pkg/types"
 	"github.com/stretchr/testify/assert"
@@ -20,7 +20,7 @@ func TestCSVRenameEndToEnd(t *testing.T) {
 	s, err := of.Output()
 	require.NoError(t, err)
 
-	data, err := helpers.ParseCSV(strings.NewReader(s))
+	data, err := csv.ParseCSV(strings.NewReader(s))
 	require.NoError(t, err)
 	require.Len(t, data, 1)
 	v, ok := data[0]["b"]
diff --git a/pkg/formatters/template_test.go b/pkg/formatters/template_test.go
index 8bc6241..f404121 100644
--- a/pkg/formatters/template_test.go
+++ b/pkg/formatters/template_test.go
@@ -2,7 +2,7 @@ package formatters
 
 import (
 	"github.com/Masterminds/sprig"
-	"github.com/go-go-golems/glazed/pkg/helpers"
+	"github.com/go-go-golems/glazed/pkg/helpers/templating"
 	"github.com/go-go-golems/glazed/pkg/middlewares/table"
 	"github.com/go-go-golems/glazed/pkg/types"
 	"github.com/stretchr/testify/assert"
@@ -18,7 +18,7 @@ func TestTemplateRenameEndToEnd(t *testing.T) {
 		tmpl,
 		[]template.FuncMap{
 			sprig.TxtFuncMap(),
-			helpers.TemplateFuncs,
+			templating.TemplateFuncs,
 		},
 		make(map[string]interface{}),
 	)
diff --git a/pkg/helpers/reflect_test.go b/pkg/helpers/reflect/reflect_test.go
similarity index 98%
rename from pkg/helpers/reflect_test.go
rename to pkg/helpers/reflect/reflect_test.go
index c4850cc..c0c3aaa 100644
--- a/pkg/helpers/reflect_test.go
+++ b/pkg/helpers/reflect/reflect_test.go
@@ -1,6 +1,7 @@
-package helpers
+package reflect
 
 import (
+	"github.com/go-go-golems/glazed/pkg/helpers/cast"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 	"reflect"
@@ -392,7 +393,7 @@ func TestReflectFloatSlice(t *testing.T) {
 	testSetReflectFloatList[float32](t, reflect.ValueOf(&s2).Elem())
 }
 
-func testSetReflectIntList[T Number](t *testing.T, sValue reflect.Value) {
+func testSetReflectIntList[T cast.Number](t *testing.T, sValue reflect.Value) {
 	err := SetReflectValue(sValue, []int{1, 2})
 	require.NoError(t, err)
 	assert.Equal(t, []T{1, 2}, sValue.Interface())
@@ -448,7 +449,7 @@ func testSetReflectIntList[T Number](t *testing.T, sValue reflect.Value) {
 	require.Error(t, err)
 }
 
-func testSetReflectFloatList[T FloatNumber](t *testing.T, sValue reflect.Value) {
+func testSetReflectFloatList[T cast.FloatNumber](t *testing.T, sValue reflect.Value) {
 	err := SetReflectValue(sValue, []float64{1.1, 2.2})
 	require.NoError(t, err)
 	assert.InDeltaSlice(t, []T{1.1, 2.2}, sValue.Interface(), 0.01)
diff --git a/pkg/helpers/strings_test.go b/pkg/helpers/strings/strings_test.go
similarity index 97%
rename from pkg/helpers/strings_test.go
rename to pkg/helpers/strings/strings_test.go
index 0aacd12..c2829b1 100644
--- a/pkg/helpers/strings_test.go
+++ b/pkg/helpers/strings/strings_test.go
@@ -1,4 +1,4 @@
-package helpers
+package strings
 
 import (
 	"github.com/stretchr/testify/assert"