nuconv is a Go code generator for
github.com/ainvaltin/nu-plugin.
It scans Go packages for annotated types and generates nuconv.gen.go files
with Nushell type definitions, parsers, and serializers.
Mark a type for generation:
// @nuconv:auto
type Config struct {
Name string `nu:"name"`
Enabled bool
}Run the generator with one or more Go package patterns:
go run . ./...For each package with generated types, nuconv writes a nuconv.gen.go file.
Generated symbols follow this pattern:
NuDef<Type>: Nushell type definitionNuParse<Type>: convert anu.Valueinto the Go typeNuSerialize<Type>: convert the Go type into anu.Value
@nuconv:autogenerates conversion code for the type.@nuconv:manualreserves the type so you can provide conversion code by hand.nu:"name"overrides the generated Nushell field name.nu:"-"skips a field.
Fields without a nu tag use snake_case names derived from the Go field name.
nuconv supports common primitive types, time.Time, time.Duration, structs,
pointers, arrays, slices, maps, named types, and type aliases.
Channels, functions, tuples, interfaces, generics, and unions are not currently supported.
Run tests with:
go test ./...